Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tranquangvu/expressjs-api-example
Sample for building RESTful APIs using Node.js, Express and MongoDB
https://github.com/tranquangvu/expressjs-api-example
Last synced: 3 months ago
JSON representation
Sample for building RESTful APIs using Node.js, Express and MongoDB
- Host: GitHub
- URL: https://github.com/tranquangvu/expressjs-api-example
- Owner: tranquangvu
- Created: 2020-11-12T09:32:41.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-04T09:52:10.000Z (about 4 years ago)
- Last Synced: 2024-03-27T10:32:18.983Z (11 months ago)
- Language: JavaScript
- Homepage:
- Size: 51.8 KB
- Stars: 2
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Expressjs + MongoDB API Example
Starter Project for building RESTful APIs using Node.js, Express and MongoDB## Features
- ES2017 latest features like Async/Await
- CORS enabled
- Uses [yarn](https://yarnpkg.com)
- Express + MongoDB ([Mongoose](http://mongoosejs.com/))
- Uses [helmet](https://github.com/helmetjs/helmet) to set some HTTP headers for security
- Load environment variables from .env files with [dotenv](https://github.com/rolodato/dotenv-safe)
- Request validation with [joi](https://github.com/hapijs/joi)
- Gzip compression with [compression](https://github.com/expressjs/compression)
- Linting with [eslint](http://eslint.org)
- Git hooks with [husky](https://github.com/typicode/husky)
- Logging with [morgan](https://github.com/expressjs/morgan)## Getting Started
#### Install dependencies:
```bash
yarn
```#### Set environment variables:
```bash
cp .env.example .env
```## Running Locally
```bash
yarn dev
```## Running in Production
```bash
yarn start
```## Lint
```bash
# lint code with ESLint
yarn lint# try to fix ESLint errors
yarn lint:fix# lint and watch for changes
yarn lint:watch
```