This repository contains the backend for a calendar application, built with Express.js, Mongoose, and JSON Web Tokens (JWT).
Before getting started, make sure you have the following installed on your system:
- Node.js (version 16 or higher)
- MongoDB
Installation Follow these steps to install and set up the project locally:
- Clone this repository to your local machine.
git clone https://github.com/WilliamsMata/calendar-backend.git
- Open a terminal in the project directory and run the command npm install to install the dependencies.
npm install
-
Create a .env file in the root directory of the project and configure the necessary environment variables. You can find an example .env.example file in the repository.
-
Run the command npm run dev to start the server.
npm run dev
- Open your browser and visit http://localhost:3000. You should see my react calendar app => https://github.com/WilliamsMata/calendar-app.
The calendar application backend provides a REST API for creating, updating, and deleting calendar events. The API uses JSON Web Tokens (JWT) to authenticate users.
https://documenter.getpostman.com/view/26056106/2s93XyU3cC
To authenticate a user, send a POST request to /auth with the user's credentials in the request body. The response will include a JWT token that can be used to make authenticated requests to the API.
To create a new calendar event, send a POST request to /api/events with the event details in the request body. Make sure to include the JWT token in the request header to authenticate the user.
To update an existing event, send a PUT request to /api/events/:id, where :id is the ID of the event you want to update. Make sure to include the JWT token in the request header to authenticate the user.
To delete an existing event, send a DELETE request to /api/events/:id, where :id is the ID of the event you want to delete. Make sure to include the JWT token in the request header to authenticate the user.
Contributions are welcome and appreciated. If you would like to contribute to this project, please make sure to follow the repository's contribution guidelines.