Skip to content

Latest commit

 

History

History
84 lines (57 loc) · 1.99 KB

File metadata and controls

84 lines (57 loc) · 1.99 KB

EasyNotes Application

Build a Restful CRUD API for a simple Note-Taking application using Node.js, Express and MongoDB.

Steps to Setup

  1. Install dependencies
npm install
  1. Run Server
node server.js

You can browse the apis at http://localhost:3000

API

Notes

Method Path Description
POST /notes Create a note
GET /notes List notes (optional filters)
GET /notes/:noteId Get one note
PUT /notes/:noteId Update a note
DELETE /notes/:noteId Delete a note

Note fields

Field Type Required Description
title string No Defaults to "Untitled Note"
content string Yes Note body
tags string[] No Labels for organizing notes; defaults to []

Create a note

curl -X POST http://localhost:3000/notes \
  -H "Content-Type: application/json" \
  -d '{"title":"Q3 Budget","content":"Review expenses","tags":["work","finance"]}'

Omitting tags creates a note with an empty tags array.

List and search notes

# All notes
curl http://localhost:3000/notes

# Filter by tag
curl "http://localhost:3000/notes?tag=work"

# Filter by multiple tags (OR)
curl "http://localhost:3000/notes?tag=work&tag=personal"

# Keyword search in title and content
curl "http://localhost:3000/notes?q=budget"

# Combined tag filter and keyword search
curl "http://localhost:3000/notes?tag=work&q=meeting"

Update a note

curl -X PUT http://localhost:3000/notes/:noteId \
  -H "Content-Type: application/json" \
  -d '{"title":"Updated","content":"New content","tags":["personal"]}'

If tags is omitted from the request body, existing tags are preserved. Send "tags": [] to clear all tags.

Tutorial

You can find the tutorial for this application at The CalliCoder Blog -

https://www.callicoder.com/node-js-express-mongodb-restful-crud-api-tutorial/