Skip to content

codewithrabeen/Notes-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ Notes API (Express.js)

A simple RESTful API built with Express.js for managing notes.

πŸš€ Features

Get all notes

  1. Get all notes

Request:

GET /notes

Response:

[ { "id": 1, "title": "First Note", "content": "This is my first note" }, { "id": 2, "title": "Seccond Note", "content": "This is my seccond note" } ]

Get a single note by ID Request:

GET /notes/1

Response (success):

{ "id": 1, "title": "First Note", "content": "This is my first note" }

Response (not found):

{ "message": "Note note found" }

Create a new note Request:

POST /notes Content-Type: application/json

{ "title": "Learn Express", "content": "Express makes backend easy!" }

Response (success):

{ "message": "Success", "note": { "id": 3, "title": "Learn Express", "content": "Express makes backend easy!" } }

Response (missing fields):

{ "message": "title and content are required" }

Update a note Request:

PUT /notes/2 Content-Type: application/json

{ "title": "Updated Note Title", "content": "Updated Note Content" }

Response (success):

{ "message": "Updated successfully", "note": { "id": 2, "title": "Updated Note Title", "content": "Updated Note Content" } }

Response (not found):

{ "message": "Note note found" }

Delete a note Request:

DELETE /notes/2

Response (success):

{ "message": "Deleted successfully", "note": { "id": 2, "title": "Seccond Note", "content": "This is my seccond note" } }

Response (not found):

{ "message": "Note note found" }

Install dependencies:

npm install

Run the server:

node index.js

Server will start at:

http://localhost:8000

πŸ“Œ API Endpoints

GET /notes β†’ Get all notes

GET /notes/:id β†’ Get note by ID

POST /notes β†’ Create a new note

PUT /notes/:id β†’ Update a note

DELETE /notes/:id β†’ Delete a note

About

A simple RESTful API built with Express.js for managing notes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published