EpyTodo is a web API for creating and managing a TODO app. This project focuses on the backend implementation using Node.js. You have the option to build a frontend as a bonus.
- Node.js installed
- MySQL server running
- Clone the repository:
git clone <repository-url>
- Navigate to the project directory:
cd EpyTodo
- Install dependencies:
npm install
- Create a
.env
file in the root directory. - Add the following configuration variables to the
.env
file:MYSQL_DATABASE
- the name of your MySQL databaseMYSQL_HOST
- the host address of your MySQL serverMYSQL_USER
- the username for accessing the MySQL serverMYSQL_ROOT_PASSWORD
- the password for the MySQL serverSECRET
- a secret key for JSON Web Token (JWT) encryptionPORT
- the port number on which the web server will listen (e.g.,3000
)
- Create a file named
epytodo.sql
. - Define the database schema in the
epytodo.sql
file. Use the provided table descriptions for theuser
andtodo
tables. - Import the
epytodo.sql
file into your MySQL server. Run the following command in the project root folder:cat epytodo.sql | mysql -u root -p
Enter your MySQL root password when prompted.
- Start the server:
npm start
- The API will be accessible at
http://localhost:3000
To test and interact with the EpyTodo API endpoints, you can use the provided EpyTodo.postman_collection.json
file in Postman. Postman is a popular API development and testing tool that allows you to send HTTP requests and view the responses.
Here's how you can use the EpyTodo.postman_collection.json
file:
-
Download and install Postman from the official website (https://www.postman.com/downloads/), if you haven't already.
-
Launch Postman and click on the "Import" button located in the top-left corner of the Postman interface.
-
In the "Import" dialog, select the "File" tab and click on the "Choose Files" button.
-
Navigate to the location where you have saved the
EpyTodo.postman_collection.json
file and select it. -
Click the "Import" button to import the collection into Postman.
-
Once the collection is imported, you will see a new folder named "EpyTodo" in the left sidebar of Postman.
-
Expand the "EpyTodo" folder to view the available API endpoints and requests.
-
To make a request, select the desired endpoint, choose the appropriate HTTP method (e.g., POST, GET, PUT, DELETE), and click on the "Send" button.
-
Postman will send the request to the specified endpoint, and you will be able to view the response, including the status code, headers, and body.
-
Feel free to modify the requests, headers, or parameters according to your testing needs.
Using the EpyTodo.postman_collection.json
file provides a convenient way to interact with the EpyTodo API without the need to manually construct each request. It also allows you to easily explore and test different API functionalities.
Note: Ensure that the EpyTodo API server is running and accessible before sending requests from Postman.