/vanilla-node-rest-api

A full CRUD REST API implemented in bare-bones NodeJS (no framework like Express).

Primary LanguageJavaScript

Vanilla NodeJS CRUD REST API

About

A full CRUD REST API implemented in bare-bones NodeJS (no framework like Express).

Features

The endpoints are

  • GET /api/products: get all products.
  • GET /api/products/:id: get the product with id equal to :id.
  • POST /api/products: create a new product (its id is generated by the server with uuid).
  • PUT /api/products/:id: modify the product with id equal to :id.
  • DELETE /api/products/:id: delete the product with id equal to :id.

There's a test.rest file for testing the endpoints. It works with the REST Client VSCode extension.

Running

Clone the repo and run either npm start (or npm run dev for using nodemon).

Acknowledgment

Thanks to Brad Traversy for his tutorial.