The project was built using the Express framework. And uses mongoDB database and uses mongoose to connect it.
- Log: morgan
- Database framework: mongoose
- Field validation: express-validator
- Unit test: chai + mocha + nyc
- API Doc: API Doc
|-- test-backend
|-- .git_template // commit template
|-- .eslintignore // eslint ignore
|-- .eslintrc.js // eslint config
|-- .gitignore // git ignore
|-- apidoc.json // APIDoc config
|-- app.js
|-- package-lock.json
|-- package.json
|-- README.md
|-- controllers // controllers
| |-- user.js
|-- database // databae
| |-- db.js
| |-- models // database models
| |-- counter.js
| |-- user.js
|-- models // models
| |-- result.js
|-- public
|-- routes // routes
| |-- user.js
|-- test // unit test
| |-- app.spec.js
|-- utils // utils
|-- constant.js
Test demo on the website Test and API Doc.
The service is deployed on Aliyun's serverless application center.Use Aliyun's Log Service to manage logs.
https://github.com/HaoHaoP/haohaop-frontend
use dataDb
db.counter.insertOne({_id: 'userid', sequence_value: 1});
db.user.insertOne({
_id: 1,
name: 'Admin',
dob: new Date(),
address: '',
description: '',
createdAt: new Date(),
});
const DB_USER = 'haohaop';
const PASSWORD = encodeURIComponent('19960718');
const DB_URL = `mongodb://${DB_USER}:${PASSWORD}@localhost:27017/dataDb?authSource=admin`;
npm install
npm start