Skip to main content

Setup

1 – Repository and dependencies

To set up the backend locally, start by cloning the repository and installing dependencies.

git clone https://github.com/NolanBeaujault/cortest-api.git
cd cortest-api
npm install

The backend uses Node.js with Express, and requires a MySQL database. Configuration is done using environment variables in a .env file.

2 – Environment variables

Create a .env file at the root of the project with the following content:

DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=epilepsie
DB_PORT=3306

3 – Database setup

The utilisateurs table used by the backend must be created before launching the server.

You can use the provided SQL script:

mysql -u root -p < create_table_utilisateurs.sql

4 – Running the server

To start the server:

node app.js

The API will be available at: http://localhost:2880

5 – Project structure

api-express/
├── app.js # Main Express application
├── .env # Environment variables
├── data/ # Static JSON files
│ └── categories.json
├── config/nginx/ # Example Nginx configuration
│ └── default.conf
├── package.json
└── README.md