From 658c46ca77dde6a535b26de83198fbac5350ff6b Mon Sep 17 00:00:00 2001 From: Jason Viers <2023094+Beanalby@users.noreply.github.com> Date: Sat, 8 Jun 2024 15:11:49 -0400 Subject: [PATCH] Fixed doGetUser example function name In the "JavaScript Fake REST API" example for the singular "getUser", the function to make use of it is called "doGetUsers", plural, even though it takes an id and returns one user. Changed the plurality to match the function it's invoking. --- blog/javascript-fake-api/index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blog/javascript-fake-api/index.md b/blog/javascript-fake-api/index.md index 3dcec5f4..184a2d3e 100644 --- a/blog/javascript-fake-api/index.md +++ b/blog/javascript-fake-api/index.md @@ -191,7 +191,7 @@ const getUser = (id) => }); // usage -const doGetUsers = async (id) => { +const doGetUser = async (id) => { try { const result = await getUser(id); console.log(result); @@ -200,7 +200,7 @@ const doGetUsers = async (id) => { } }; -doGetUsers('1'); +doGetUser('1'); ``` Next, creating an item. If not all information is provided for the new item, the API will throw an error. Otherwise a new identifier for the item is generated and used to store the new item in the pseudo database: @@ -297,4 +297,4 @@ doDeleteUser('1'); We have implemented the entire fake API for a RESTful resource (here user resource). It includes all CRUD operations, has a fake delay and returns an asynchronous result. For the write operations, the API only returns an acknowledgment (boolean), however, you could also decide to return an identifier (e.g. identifier of the removed item) or an item (e.g. the created/updated item). - \ No newline at end of file +