Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nemtsov/express-starter
Express Starter
https://github.com/nemtsov/express-starter
docker express jwt-authentication nodejs postgresql
Last synced: about 1 month ago
JSON representation
Express Starter
- Host: GitHub
- URL: https://github.com/nemtsov/express-starter
- Owner: nemtsov
- License: mit
- Created: 2016-02-01T19:33:12.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-07-28T10:15:11.000Z (over 3 years ago)
- Last Synced: 2024-04-13T17:13:05.705Z (9 months ago)
- Topics: docker, express, jwt-authentication, nodejs, postgresql
- Language: JavaScript
- Homepage:
- Size: 508 KB
- Stars: 14
- Watchers: 5
- Forks: 6
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Express Starter ![ci](https://travis-ci.org/nemtsov/express-starter.svg?branch=master)
This is a starter project for the Express and Node >= 8 featuring:
- Docker
- PostgreSQL
- JWT-based authentication
- `async / await` everywhere
- Designed for ease of testing with an emphasis on "few-millisecond-fast" end-to-end tests
- Service-based folder structure (each folder in `/lib` is a separate service, with its own `index.js`, `datastore.js` [if necessary], and a web `resource.js`) for easier navigation
- Configuration is done via environment variablesThe `lib/github` service is here to serve as an example of how a service
that has an http resource as well as non-trivial dependencies may be
implemented and tested.Note: Minimum requirement is Node v8.0.0
## Usage
Development:
`docker-compose up`Testing:
`npm test`Check coverage:
`npm run test:cover`Re-run tests when a file changes:
`npm run test:watch`Production:
`npm install`
`npm start`## Auth
Create a new user:
```
curl -i -XPOST 'http://localhost:4000/users' -H 'Content-type: application/json' -d '{"email": "[email protected]", "password": "pass"}'
```Create a token for the user:
```
curl -i -XPOST -u '[email protected]:pass' 'http://localhost:4000/tokens'
```Use the token to get data:
```
curl -i 'http://localhost:4000/github/nodejs' -H 'Authorization: Bearer '
```## License
[MIT](/LICENSE)