a simple task manager
This README provides detailed instructions on how to set up and run the server for this project. The server relies on a MySQL database and specific environment settings defined in a .env
file.
Before proceeding, ensure you have the following installed:
- Node.js: Node.js runtime environment.
- npm: Comes with Node.js, but you can check npm's installation guide if needed.
- MySQL: Database system used by the server. Installation guides can be found on the MySQL official website.
Follow these steps carefully to ensure a successful setup of the server environment and the database.
Before launching the server, create the MySQL database:
- Log into your MySQL environment (using MySQL Workbench, command line, or another tool).
- Execute the following SQL command to create a new database:
CREATE DATABASE taskmanager;
- Ensure the MySQL server is running.
Create a .env
file in the root directory of the project and add the following environment variables:
plaintextCopy code
MYSQL_HOST=127.0.0.1 MYSQL_USER=user MYSQL_PASSWORD=password PORT=3000 TOKEN_KEY=ASDF MYSQL_DATABASE=taskmanager
Important: For security, ensure to change the MYSQL_PASSWORD
and TOKEN_KEY
values before deploying in a production environment.
Open your terminal, navigate to the project directory, and run the following command to install all necessary dependencies:
bashCopy code
npm install
After setting up the database and installing all dependencies, start the server by running:
bashCopy code
node server
The server will launch and listen on the port specified in your .env
file (3000
by default). Access the server at http://localhost:3000
.
The server will launch and listen on the port specified in your .env file (3000 by default). Access the server at http://localhost:3000.