This project was a test for me to see how far JS has come along to be actually used for a backend. A few years ago I also created a backend for a small application in NodeJS with regular old javascript (I did not have a lot of experience with javascript then), but I really hated it. Now with typescript, I wanted to give it another chance.
I also make a lot of use of the new async/await syntax.
- Run
yarn install
- Run
docker-compose up
, this will run the container for the mysql db. - Run
docker ps
to find the name of the docker container. - Run
docker exec -i -t <docker-container-name> /bin/bash
to open a bash in the container. - Run
mysql -u root -p
and fill in the password 'root'. - Run the sql scripts in the db-scripts folder to create the correct tables and fill them with dummy data.
- Run
npm run build
to compile the typescript into the dist folder. - Run
node dist/index.js
to run the application.
You can now use postman to do requests to http://localhost:3000. For full URL's, check the classes in the src/routes folder.