-
This project helps one to build a simple Node.js & Express server and create a set of endpoints.
-
First, you will build an endpoint to retrieve data (GET).
-
Next, you will discover how to create endpoints for POST, PUT, PATCH and DELETE.
-
Then, you will delve into the different HTTP status codes that you should return from each endpoint.
-
Next, you will explore how to handle exceptions and return a standardized JSON document.
-
Finally, you will see how to call your REST APIs from JavaScript using the XMLHttpRequest object.
-
This will help improve one's skills and knowledge of Node.js, Express, and JavaScript needed to build your own REST APIs for use in mobile or other applications.
This has the code for:
- Retrieve & Search for Data Using REST API Methods. (GET)
- Build REST API Methods to Modify Data. (POST, PUT, DELETE, PATCH)
- Handling Exceptions in REST API Methods & writting errors in to a Log file.
- Load HTML Page & call one of the REST API.
- Firstly clone the repo.
- npm install express nodemon -save
- npm install cors
- npm start
This has the code for:
- Create a website using the Express generator.
- Add Request package to website & call REST APIs.
- npm install express-generator -g
- express NithinsPieWebsite --view=hbs
- cd NithinsPieWebsite/
- npm install
- npm install nodemon -save
- npm install request --save
- npm start
- Go to http://localhost:3000/ (To check the express server running locally)