Express API
A basic Express.js API example written during the Media Engineering Web-Oriented Architecture course.
Requirements
Usage
# Clone the repository
git clone https://github.com/MediaComem/comem-archioweb-2023-2024-express-api.git
# Install dependencies
cd comem-archioweb-2023-2024-express-api
npm ci
# Run the application
npm start
# Run the application in development mode with live reload
npm run dev
Configuration
The application is configured through the following environment variables:
Variable | Default value | Description |
---|---|---|
BCRYPT_COST_FACTOR |
10 |
Cost factor for password hashing with bcrypt. |
DATABASE_URL |
mongodb://localhost/express-api |
The MongoDB connection URI. |
JWT_SECRET |
- | The secret used to sign JWTs. It should be a long random string. |
PORT |
3000 |
The port the server will listen on. |
This application includes dotenv. In
development, you can also copy the .env.sample
file to .env
and adapt it to
suit your environment.