Showing posts from August 1, 2020

Build your own REST API from scratch - Part 2

In the previous article we have created a basic skeleton for our RESTful API.  In this part we are going to crack it up a notch by building an actual useful endpoint, status codes, change the static message to a better mechanism, build our controllers, and see how we can retrieve actual useful data via an API call. Ready? Let's keep coding. For starters, let's change focus by deciding that we are building an Ice Cream shop API.  WOW, just the thought of that made me hungry... Oh well, back to work. so the first thing we want to do is to change the static hello message we retrieved to some actual content. For that, we are going to: Create a JSON data file Our JSON file will contain an array of objects containing our menu items. We will place this file in a sub-directory in our project which we will call menu_data. Next up, let's create a separate module to handle our Ice cream menu get method. I will call it iceCream.js and place in an additional directory in our project whi