A simple backend for a note-taking application using TypeScript, NodeJS, and Express.
Make sure you have the following installed on your machine:
-
Clone the repository:
git clone https://github.com/dev-jolo/note-taking-be.git
-
Navigate to the project folder:
cd note-taking-be -
Install dependencies:
npm install
-
Create
.envfile and provide variables needed- Create file
touch .env
- Provide variables
PORT=8080 NOTES_PATH='./data/notes.json'
- Create file
Database used is file handled which in json format for ease of use. Only one user per database thus reading and writing from file is in sync format.
- The API will be running at http://localhost:8080.
-
Build the server:
npm run build
-
Start the server:
npm run start
- Using the uploaded
thunder-collection_Notes.jsonfile, you can import it in Thunder Client via VSCode or in Postman
| HTTP Verbs | Endpoints | Action |
|---|---|---|
| POST | /api/notes | Create a new note. |
| GET | /api/notes | Retrieve all notes |
| GET | /api/notes/:id | Retrieve a specific note by ID. |
| PUT | /api/notes/:id | Update a specific note. |
| DELETE | /api/notes/:id | Delete a specific note. |
PORT: Port on which the server will run. Default is 8080.NOTES_PATH: Path on which the file db will be in. Default is "./data/notes.json"
Create a .env file in the root of your project and define the necessary environment variables.
Note: Ensure that you do not commit your .env file to version control
Example .env file:
PORT=8080
NOTES_PATH='./data/notes.json'