Under development. 開発中です。
Clone the repo:
git clone [email protected]:tochi-y/meshi-api.git
cd meshiInstall yarn:
npm install -g yarnInstall dependencies:
yarnSet environment (vars):
cp .env.example .envStart server:
# Start server
yarn start
# Selectively set DEBUG env var to get logs
DEBUG=meshi-api:* yarn startRefer debug to know how to selectively turn on logs.
Tests:
# Run tests written in ES6
yarn test
# Run test along with code coverage
yarn test:coverage
# Run tests on file change
yarn test:watch
# Run tests enforcing code coverage (configured via .istanbul.yml)
yarn test:check-coverageLint:
# Lint code with ESLint
yarn lint
# Run lint on any file change
yarn lint:watchOther gulp tasks:
# Wipe out dist and coverage directory
gulp clean
# Default task: Wipes out dist and coverage directory. Compiles using babel.
gulp# compile to ES5
1. yarn build
# upload dist/ to your server
2. scp -rp dist/ user@dest:/path
# install production dependencies only
3. yarn --production
# Use any process manager to start your services
4. pm2 start dist/index.jsIn production you need to make sure your server is always up so you should ideally use any of the process manager recommended here. We recommend pm2 as it has several useful features like it can be configured to auto-start your services if system is rebooted.
Universal logging library winston is used for logging. It has support for multiple transports. A transport is essentially a storage device for your logs. Each instance of a winston logger can have multiple transports configured at different levels. For example, one may want error logs to be stored in a persistent remote location (like a database), but all logs output to the console or a local file. We just log to the console for simplicity, you can configure more transports as per your requirement.
Logs detailed info about each api request to console during development.
Logs stacktrace of error to console along with other details. You should ideally store all error messages persistently.
Get code coverage summary on executing yarn test
yarn test also generates HTML code coverage report in coverage/ directory. Open lcov-report/index.html to view it.

# For Development
# service restarts on file change
1. bash bin/development.shContributions, questions and comments are all welcome and encouraged. For code contributions submit a pull request with unit test.
This project is licensed under the MIT License
This project is based on express-mongoose-es6-rest-api. I appreciate for the project.
Tochiori Yasufumi – @tochi_ondy – [email protected]