在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):amida-tech/api-boilerplate开源软件地址(OpenSource Url):https://github.com/amida-tech/api-boilerplate开源编程语言(OpenSource Language):JavaScript 72.6%开源软件介绍(OpenSource Introduction):Amida API BoilerplateOverviewThis is a boilerplate application for building REST APIs in Node.js using ES6 and Express. Intended for use with PostgreSQL using Sequelize ORM. Features
Getting StartedInstall yarn:npm install -g yarn Install dependencies:yarn Set environment (vars):cp .env.example .env Start server:# Ensure that a PostgreSQL database is running on your localhost
# Start server
yarn start
# Selectively set DEBUG env var to get logs
DEBUG=amida-api-boilerplate:* yarn start 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 Lint:# Lint code with ESLint
yarn lint
# Run lint on any file change
yarn lint:watch Other gulp tasks:# Wipe out dist and coverage directory
gulp clean
# Default task: Wipes out dist and coverage directory. Compiles using babel.
gulp Deployment# 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.js LoggingUniversal 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. API loggingLogs detailed info about each api request to console during development. Error loggingLogs stacktrace of error to console along with other details. You should ideally store all error messages persistently. Code CoverageGet code coverage summary on executing
Docker DeploymentDocker Compose:# In `.env` file, assign `UNIQUE_NAME_PG_HOST` to amida-db
1. sed -i s/localhost/amida-db/ .env
# Run:
2. yarn build && docker-compose up AWS DeploymentThe basic steps for deploying to AWS are:
Further details can be found in the |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论