Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrtimofey/node-stories
Node.js based REST API with users, their stories and quota management
https://github.com/mrtimofey/node-stories
Last synced: about 1 month ago
JSON representation
Node.js based REST API with users, their stories and quota management
- Host: GitHub
- URL: https://github.com/mrtimofey/node-stories
- Owner: mrTimofey
- Created: 2018-07-27T13:18:55.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T01:35:03.000Z (almost 2 years ago)
- Last Synced: 2023-02-27T19:05:11.591Z (almost 2 years ago)
- Language: JavaScript
- Homepage:
- Size: 1.72 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Users and their stories
Node.js based REST API with users, their stories and quota management.
Involved npm packages:
* `nedb` as an embeddable database
* `camo` - ODM for `nedb`
* `indicative` - declarative validation library
* `password-hash` - guess what
* `polka` - lightweight express-like web server
* `jest`, `axios` for API tests
* `eslint` for code quality## Quick start
```
npm i
npm start
```First administrator user will be created automatically
if you start the API server without any administrators created.Initial credentials: email `[email protected]`, password `secret`
**It is strongly recommended to change these credentials ASAP.**
## Prerequisites
You only need `node >= 9.11.2` and `npm >= 6.2.0` (may be less but not tested).
## Commands
* `npm test` - run tests
* `npm start` - start API server on port 3000
* `npm run wipe` - clean database## Configuration
The application can be configured with the following environment variables:
* PORT - application port, default `3000`
* DATA_FOLDER - NeDB database files relative to `process.env()`, default `data`.Run application with your configuration:
```
PORT=8000 DATA_FOLDER=test-data node index
```## Project structure
* \_\_tests\_\_ - tests folder
* api - api server related sources
* index.js - server initialization and routes
* resource.js - Resource class which extends ODM with API resource logic
* utils.js - useful server functions
* data - NeDB database files default location
* models - ODM models/API resources, blueprints for API routes
* validators - custom validation rules, automatically exposed into `indicative.validators`
* app.js - application setup sources
* index.js - application entry point
* swagger.yml - API documentation