The Speer Note API is a powerful tool for managing your notes. It provides various endpoints for user authentication, note management, and keyword-based note searching. Below, you'll find a detailed guide on how to interact with the API, along with key features and example requests.
| Deployed Link |
|---|
https://speer-note.vercel.app/api |
- Node.js v14.15.0 or higher
- NPM v6.14.8 or higher
- MongoDB v4.4 or higher
The API uses JSON Web Tokens (JWT) for authentication. To access authenticated routes, include a valid JWT in the Authorization header of your requests. The endpoints with a 🔒 at end, signifies a protected route
steps to locally configure and run this app
git clone https://github.com/prithidevghosh/speerNote.git
npm install
nodemon
The application requires a MongoDB instance to be set up. You can configure the database connection by setting the following environment variables:
MONGOURI = "your mongo cluster URI"
PORT=8008
TOKEN_SECRET = "your own token secret"
You can set these environment variables in a .env file in the root directory of the application.
| Endpoint Name | Method | Purpose |
|---|---|---|
/auth/signup |
POST | User Registration (Sign-Up) |
/auth/login |
POST | User Authentication (Sign-In) |
/notes 🔒 |
GET | Retrieve Notes |
/notes 🔒 |
POST | Create Note |
/notes/delete/:noteid 🔒 |
DELETE | Delete Note |
/notes/update/:noteid 🔒 |
PUT | Update Note |
/notes/share/:shareduserid/:noteid 🔒 |
POST | Share Note |
/search?q=your_query 🔒 |
GET | Search Notes |
curl --location 'https://speer-note.vercel.app/api/auth/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"email":"ghosh1@email.com",
"password":"ghosh1"
}'
Here is a list of features added to the Speer Note application:
- User Authentication:
- Users can create a new account (/auth/signup).
- Users can log in to their account (/auth/login).
- Note Management:
- Users can retrieve their notes (/notes - GET).
- Users can create a new note (/notes - POST).
- Users can delete a note (/notes/delete/:noteid - DELETE).
- Users can update a note (/notes/update/:noteid - PUT).
- Users can share a note with another user (/notes/share/:shareduserid/:noteid - POST).
- Search Functionality:
- Users can search for notes based on keywords (/search?q=your_query).
- Middleware:
- Passport authentication middleware is used to secure routes.
- Database:
- MongoDB is used as the database, and Mongoose is the ODM.
- Token-based Authentication:
- JSON Web Tokens (JWT) are used for secure user authentication.
- Environment Variables:
- Environment variables are used to store sensitive information like database connection URI and token secret.
- Deployed on Vercel:
- The application is deployed on Vercel, and the base production URL is https://speer-note.vercel.app/.