This project is used to provide CRUD APIs to the Journal application in the frontend. It has been deployed in render through this link. You can also choose to install the project as follows:
- Ensure Node.js is installed in your machine.
- Clone the repository:
git clone https://github.com/naim-2/Journal-Backend
cd Journal-Backend
- Install the dependencies:
npm install
- Run the following commands to start the server:
npx tsc
npx ts-node-dev src/index.ts
- Endpoint: /api/auth/register
- Method: POST
- Request body: { "username": "string", "email": "string", "password": "string" }
- Response: User registered
- Screenshot:
- Endpoint: /api/auth/login
- Method: POST
- Request body: { "email": "string", "password": "string" }
- Response: { "token": "string" }
- Screenshot:
- Endpoint: /api/user
- Method: PUT
- Header: { "Authorization": "Bearer <your_jwt_token>" }
- Request body (at least username or password must be included as not null): { "email": "string", "username": "string", "password": "string" }
- Response: User updated successfully
- Screenshot:
-
Endpoint: /api/journal
-
Method: POST
-
Header: { "Authorization": "Bearer <your_jwt_token>" }
-
Request body: { "title": "string", "content": "string", "category": "string", "date": "string (YYYY-MM-DD)" }
-
Response: { "id": "number", "title": "string", "content": "string", "category": "string", "date": "string (YYYY-MM-DD)" }
- Endpoint: /api/journal
- Method: GET
- Header: { "Authorization": "Bearer <your_jwt_token>" }
- Response: [{ "id": "number", "title": "string", "content": "string", "category": "string", "date": "string (YYYY-MM-DD)" }, { "id": "number", "title": "string", "content": "string", "category": "string", "date": "string (YYYY-MM-DD)" }]
- Screenshot:
- Endpoint: /api/journal
- Method: PUT
- Header: { "Authorization": "Bearer <your_jwt_token>" }
- Request body: { "id": "number", "title": "string", "content": "string", "category": "string", "date": "string (YYYY-MM-DD)" }
- Response: { "id": "number", "title": "string", "content": "string", "category": "string", "date": "string (YYYY-MM-DD)" }
- Screenshot: