This is the backend component of EcoTrack, a revolutionary web application that helps individuals reduce their carbon footprint and embrace sustainable practices. The backend is responsible for handling API requests, interacting with the database, and implementing the core logic of the application.
- Node.js
- Express.js
- TiDB Cloud
- Other dependencies (listed in package.json)
- Node.js (v19.7.0)
- TiDB Cloud account (for database connection)
- Clone the repository:
git clone https://github.com/Project-Eco-Track/Eco-Track-Server/.git
- Navigate to the project directory:
cd Eco-Track-Server
- Install dependencies:
npm install
-
Create a .env file in the root of the backend directory.
-
Add the following environment variables to the .env file:
# for tiDB.js
TIDB_HOST=your-tidb-host
TIDB_PORT=your-tidb-port
TIDB_USER=your-tidb-username
TIDB_PASSWORD=your-tidb-password
TIDB_DATABASE='test'
# for server.js
PORT=3001
Replace the values with your MongoDB and TiDB Cloud connection details.
TIDB_PUBLIC_KEY_R = Public Key with read access
TIDB_PRIVATE_KEY_R = Private Key with read acess
TIDB_PUBLIC_KEY_RW = Public Key with Read/Write access
TIDB_PRIVATE_KEY_RW = Private Key with Read/Write acess
Start the backend server with the following command:
- while in the root folder (Eco-Track-Server):
npm run dev
The server will be running at http://localhost:3001
- Read CONTRIBUTING.md before starting to contribute.