Skip to content

An attempt to make a basic CRUD using only native modules from Node.

License

Notifications You must be signed in to change notification settings

daspeon/native-node-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js logo

Native Node API

dependencies javascript node MIT License

Table of Contents

About

The purpose of this project was to create a simple API with basic CRUD (Create, Read, Update, Delete) operations using only native modules from Node, such as fs to write and read files and http to create the server and handle requests. No database was used, all the records are stored in a single .txt file that is single handed by Node file system module.

Requirements:

If you use NVM, just run nvm use inside of the root folder.

Installing:

Since the project was made using only native modules, there's no need to run npm i ou yarn, just clone this repository and you're good to go.

Usage

Starting

$ npm start # Project will start at http://localhost:8001/

Routes

route HTTP method params description
/ GET - Home page
/movies GET - List Movies
/movies POST - Create Movie
/movies/:id GET :id Find Movie
/movies/:id UPDATE :id Update Movie
/movies/:id DELETE :id Delete Movie

Requests

  • POST /movies

Request body:

{
  "title": "Legally Blonde",
  "year": 2001,
  "genre": "comedy",
  "duration": 96,
  "ageRating": 13,
  "director": "Robert Luketic"
}
  • PUT /movies/:id

Request body:

{
  "title": "Legally Blonde",
  "year": 2001,
  "genre": "comedy",
  "duration": 96,
  "ageRating": 13,
  "director": "Robert Luketic"
}

⬆ Back to the top

About

An attempt to make a basic CRUD using only native modules from Node.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published