A restful API built with Node.js, MySQL, JWT authentication, TypeScript, and Docker.
This project uses Docker and docker-compose.
Rename the .env.example
file into .env
and modify it according to your credentials and settings.
The Docker container includes the Node.js and the MySQL servers. Start the servers with the following command:
docker compose up -d
A web server will be setup, available at http://localhost:4968. Change to TypeScript files will trigger an automatic reload of the server, and your modifications will imediatelly be taken into account. One database named bugtracker_db
is also created in the MySQL server. Please note that the server may take a moment to install dependencies and start.
To stop, run docker-compose stop
or hit CTRL-C on the terminal your docker-compose is running in.
After that, to start with code changes, you'll want to docker-compose down
to clean up.
Logs of containerized servers are captured and available in Docker logs.
On first run, the app is populated with initial data: tasks, users, projects, comments. See init.sql
SQL dump for more details. The initial accounts are as follows:
Username | Password | Role |
---|---|---|
marie@rose.com | marie@rose.com | admin |
anna@brown.com | anna@brown.com | member |
samuel@doe.com | samuel@doe.com | member |
An api with the following routes
/signup
and/login
./tasks
/projects
/users
/comments
An authentication system is included using the jsonwebtoken library.
/signup
helps create an account/login
generates a token if validusername
andpassword
are provided- All the other routes are protected by the token authentication system
Tests are grouped under the folder src/__tests__
and are powered by Jest. Run all test suites with the following command:
npm test