Skip to content

Plug-org/plug-notes-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plug Notes API

A beginner-friendly REST API for practicing frontend development with a "real" backend. Built with Express and SQLite. No auth to keep things simple for this easy level API.

Features

  • Full CRUD on /notes
  • Persistent local SQLite storage
  • initial data already seeded
  • reset endpoint to restore initial data
  • CORS-enabled and JSON-ready

Setup

  1. Clone the repo
git clone https://github.com/Plug-org/plug-notes-api.git
cd plug-notes-api
  1. Install dependencies
npm install
  1. Run the API
npm run dev
  1. Seed the database
npm run seed

The server will start at http://localhost:5000.

Endpoints

Get all notes

GET /notes

response

 [
    {
        "id": 1,
        "title": "Welcome Note",
        "content": "This is a sample note to get started. Feel free to add, edit, or delete.",
        "created_at": "2025-05-21 03:38:26"
    },
    {
        "id": 2,
        "title": "Next Steps",
        "content": "Try connecting this API to a frontend like React or Vue!",
        "created_at": "2025-05-21 03:38:26"
    }
 ]

Get a note by ID

GET /notes/:id

response

{
    "id": 2,
    "title": "Next Steps",
    "content": "Try connecting this API to a frontend like React or Vue!",
    "created_at": "2025-05-21 03:38:26"
}

Create a new note

POST /notes
Content-Type: application/json

{
  "title": "My Note",
  "content": "Something useful."
}

successful response

{
    "id": 5,
    "title": "My Note",
    "content": "Something useful.",
    "created_at": "2025-05-21 18:54:04"
}

Update a note

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

{
  "title": "Updated Title",
  "content": "Updated content."
}

successful response

{
    "id": 1,
    "title": "Updated Title",
    "content": "Updated content.",
    "created_at": "2025-05-21 03:38:26"
}

Delete a note

DELETE /notes/:id

succesful response

{
    "success": true
}

Reset notes to initial data

POST /reset

successful response

{
    "success": true
}

Make a GET request to /notes again to see all notes and you should see the initial data

You'll notice the newly re-seeded data will have ids that are new (not 1 and 2) and they'll have up to date timestamps

If you ever want to start from scratch this will erase the data in the database and then loads sample notes from seed_data.json.

File Structure

plug-notes-api/
├── app.js                   # Main server
├── notes.db                 # Local SQLite DB (auto-created)
├── notes.db-shm             # Local SQLite DB (auto-created)
├── notes.db-wal             # Local SQLite DB (auto-created)
├── package.json             # Project metadata
└── README.md                # This file
├──seed/
      ├── seed_data.json     # initial data 
      ├── seed.js            # script to seed initial data

Who is this for?

  • Frontend devs learning how to interact with APIs
  • Bootcamp students and self-taught devs

This is a very basic CRUD app to get started with.

Tips and Troubleshooting

  1. Check out Postman to learn how to test api calls in isolation before writing any code in your client.
  2. Keep the server's CLI open so you can see any logging information.
  3. Make use of dev tools like Google Chrome network activity inspector tab.

License

MIT

About

A very basic CRUD api to get started.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published