Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/robinofskii/genericapi

A generic REST API built on Express and Mongoose, used for testing some of my own smaller projects.
https://github.com/robinofskii/genericapi

Last synced: about 1 month ago
JSON representation

A generic REST API built on Express and Mongoose, used for testing some of my own smaller projects.

Awesome Lists containing this project

README

        

# GenericAPI

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.

## Installation

1. Clone or Fork this repo.
2. Run `npm install` to get all dependencies.
3. Create a `.env` file in the root folder and add the variables listed below.

### Variables

- `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](https://cloud.mongodb.com/), 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](https://jwt.io/) 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.

## Usage

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](https://insomnia.rest/) for sending requests.

## License

[MIT](https://choosealicense.com/licenses/mit/)