This is a RESTful API for a blogging application.
To get started with the API, follow these steps:
- Clone the repository.
- Install the dependencies by running
npm install
. - Set up the environment variables in a
.env
file. - Start the server by running
npm start
.
- Route:
POST /api/register
- Route:
POST /api/login
- Route:
POST /api/posts
- Route:
PUT /api/posts/:postId
- Route:
DELETE /api/posts/:postId
- Route:
POST /api/posts/:postId/comments
- Route:
PUT /api/posts/:postId/comments/:commentId
- Route:
DELETE /api/posts/:postId/comments/:commentId
- Route:
GET /api/users/:userId
- Route:
GET /api/users/:userId/feed
- Route:
POST /api/posts/:postId/like
- Route:
DELETE /api/posts/:postId/like
Please note that the :postId
, :commentId
, and :userId
in the routes are parameters that should be replaced with the actual values when making requests.
The API handles errors using an error handling middleware. If any errors occur during the API's execution, an appropriate error response will be returned.
- Node.js
- Express.js
- MongoDB
- Mongoose
- JSON Web Tokens (JWT)
Contributions are welcome! If you find any issues with the API or have any suggestions, please open an issue or submit a pull request.
This project is licensed under the MIT License.