This is our first Rest Api we have practiced to create in node. It provides CRUD operations on a resource, which is defined in the datastorage module.
this server uses Express for routing and CORS to handle cross-origin requests. You can use variable sources: employees and computers.
http://localhost:3000/api/computers
inside the storageLayer.js: you need to uncomment line 11-13 and comment line 7-9 to change the route to
http://localhost:3000/api/employees
- Clone this repo to your local machine.
- Install dependencies:
npm install- Start the server:
node restServer.js- you can run this program also in your browser with the provided UI: just drag and drop the html file inside the folder: restTester to your browserwindow and put in the endpoint: "computers"
with Node. js Fetch API
to be able to make API requests and responses on the server