This repository contains the backend code for the Cursos UFCG service. It is an Express/Node.js reimplementation of its legacy version in Python. It provides the necessary server-side functionality to support the Cursos UFCG service.
Before running the application, make sure you have the following prerequisites installed:
- Node.js (version 12 or higher)
- Docker (optional - for running Redis and/or the server in a container)
To install dependencies:
npm install
-
Create a
.env
file based on the provided.env.example
file. -
Fill in the required environment variables in the
.env
file. Make sure to provide appropriate values (see Enviroment Variables)
-
To start the server in development mode:
- Start the Redis Server (optional):
npm run redis:run-detached
- Run the application in development mode:
npm run dev
- Start the Redis Server (optional):
-
To run tests:
npm test
-
To start the server in production mode:
- Build the project:
npm run build
- Run the applicatiom in production mode:
npm start
- Build the project:
-
To start the server in a container:
npm run docker-compose:up
-
To build the Docker image:
npm run docker:build
-
To start the Docker containers using Docker Compose:
npm run docker-compose:up
-
To stop the Docker containers:
npm run docker:stop
The following is a description of the enviroment variables used in the project.
-
DB_DRIVER
: The database driver (e.g., MySQL ODBC 8.0 Driver). -
DB_SERVER
: The database server address. -
DB_PORT
: The database server port. -
DB_USER
: The database user. -
DB_PASSWORD
: The database password. -
DB_NAME
: The name of the database. -
DB_DEFAULT_SCHEMA
: The default database schema. -
REDIS_HOST
: The Redis server host. -
REDIS_PORT
: The Redis server port. -
REDIS_CACHE_EXPIRATION_TIME_MS
: The expiration time for cached data in milliseconds. -
OPENCPU_SERVER
: The OpenCPU server address. -
OPENCPU_PORT
: The OpenCPU server port. -
API_PORT
: The port on which the API server will run (default 3000)
We welcome contributions to the Cursos UFCG project. If you would like to contribute, please follow these steps:
-
Fork the repository.
-
Create a new branch for your feature or bug fix.
-
Make your changes and commit them with descriptive commit messages.
-
Push your changes to your forked repository.
-
Submit a pull request to the main repository.
This project is licensed under the MIT License.