A generic REST API built on Express and Mongoose, used for testing some of my own smaller project. Feel free to Fork and use it for yourself, or maybe make your own variations on it. I don't know what is going to be in here yet and when I'll deem it "finished", but take this as-is without any promises.
- Clone or Fork this repo.
- Run
npm install
to get all dependencies. - Create a
.env
file in the root folder and add the variables listed below.
PORT
Here you can provide a port on which the server will run.DB_CONNECTION
This is where you can provide a MongoDB connection string, you will need to create your own account and cluster first.JWT_SECRET
To give out tokens to make authentication easier with following requests, a token secret is needed. JWT will use this secret to generate and validate tokens.JWT_EXPIRES_IN
The token will expire in the amount of days provided in this variable.
After installing all dependencies and creating an .env, you can start the server with npm start
and send requests to the different routes. I personally use Insomnia for sending requests.