An Express template that uses:
This template is free to use and can be used for any purpose. Also, you can change it however you want. The folder distribution is just to show I would like it to be distributed.
First you will need to create a .env file in the root of your project. This file will contain the following information:
PORT: By default 3000, but you can change it with this variable
DB_USERNAME: The username for your database
DB_PASSWORD: The password for your database
DB_NAME: The name of your database
DB_PORT: The port in which your database is running (by default 5432)
JWT_SECRET: The secret key used to sign the JWT token
To run this project you can either use docker-compose or run it manually.
If you choose to use docker-compose, you can run the following command to start the project:
docker-compose up
And that's it!
If you choose to run the project manually, you will need to install the following programs:
Then you must install the dependencies using the following command:
yarn install
Finally, you can run the project in development mode using the following command:
yarn dev
This command will reset the server every time a file changes.
If you wish to run the project normally, you can run the following command:
yarn start
I also included some extra packages that I use in my projects, if you want to remove them feel free to do it!
- Bcrypt used for hashing.
- Dotenv to read .env files.
- Eslint with airbnb configuration, to check code quality.
- Jsonwebtoken to generate auth tokens.
This template also includes a User CRUD. If you wish to remove it, please feel free to do it! I just included it to show you how I would use this template.