This is a boilerplate project for a Node.js application. It uses MongoDB as a database and includes configuration for JWT authentication.
- Clone the repository
- Install dependencies with
npm install
Start MongoDB with the following command:
mongod --dbpath "~/data/db"
Instead of npm start
, you can use nodemon for automatic reloading. Run the server with:
npx nodemon
The project uses the following environment variables:
DATABASE
: The MongoDB connection string. Default is'mongodb://127.0.0.1:27017/'
.PORT
: The port the server will listen on. Default is4000
.JWT_SECRET
: The secret key used for JWT authentication. Replace"secret_here"
with your own secret key.LOG_LEVEL
: The level of logging. Default isdebug
.NODE_ENV
: The environment the application is running in. Default isdevelopment
.
Remember to replace the default values with your own, especially JWT_SECRET
.