Boilerplate/Generator/Starter Project for building RESTful APIs and microservices using Node.js, Express and MongoDB
git clone --depth 1 https://github.com/danielfsousa/express-rest-es2017-boilerplate
cd express-rest-es2017-boilerplate
rm -rf .git
yarn
cp .env.example .env
yarn dev
yarn start
# lint code with ESLint
yarn lint
# try to fix ESLint errors
yarn lint:fix
# lint and watch for changes
yarn lint:watch
# run all tests with Mocha
yarn test
# run unit tests
yarn test:unit
# run integration tests
yarn test:integration
# run all tests and watch for changes
yarn test:watch
# open nyc test coverage reports
yarn coverage
# run lint and tests
yarn validate
# show logs in production
pm2 logs
# generate and open api documentation
yarn docs
# run container locally
yarn docker:dev
# run container in production
yarn docker:prod
# run tests
yarn docker:test
Set your server ip:
DEPLOY_SERVER=127.0.0.1
Replace my Docker username with yours:
nano deploy.sh
Run deploy script:
yarn deploy
1.REST简介 REST是指表述性状态传递(Representational State Transfer,简称REST),是Roy Fielding 博士在2000年他的博士论文中提出来的一种软件架构风格。 表述性状态转移是一组架构约束条件和原则。满足这些约束条件和原则的应用程序或设计就是RESTful。 需要注意的是,REST是设计风格而不是标准。REST通常基于使用HTTP、URI和XML
一、Express中的路由 在Express中,路由指的是客户端的请求与服务器处理函数之间的映射关系。 Express中的路由分3部分组成,分别是请求的类型、请求的URL地址、处理函数。 1、Express中的路由的例子 匹配GET请求,且请求URL为 / app.get('/',function(req,res){ res.send('Hello
express的基本使用 npm init//创建管理文档 npm i express -S //-S表示在生产环境下也要用到的包 var express = require('express');//导出express的顶级函数 var app = express();//创建express对象 app.get('/', function(req, res){//监听get请求的'/'地址
原因: express.urlencoded()中间件默认只能解析100kb的application/x-www-form-urlencoded编码的文件,当文件大小超过100Kb就会报错 解决方案: 配置解析文件大小 // 配置解析application/x-www-form-urlencoded格式的表单数据的中间件 app.use(express.urlencoded({ extended:
express-rest-api-boilerplate Express REST API with JWT Authentication and support for sqlite, mysql, and postgresql authentication via JWT routes mapping via express-routes-mapper support for sqlite,
express-mongodb-rest-api-boilerplate Also express-graphql-mongodb-boilerplate - GraphQL API Boilerplate Authentication from scratch Sign In, Sign Up, Reset Password, Change Password, Update User E-mai
Express Boilerplate ExpressJS boilerplate with Socket.IO, Mongoose for scalable projects. Includes ExpressJS NodeJS Mongoose Socket.io Nodemon API-Docs Getting Started These instructions will get you
Express, React/Redux, MySQL Boilerplate Get Started 1. Prerequisites NodeJs NPM - Node package manager MySQL - Relational database management system (RDBMS) 2. Installation On the command prompt run t
express-graphql-boilerplate Express GraphQL API with JWT Authentication and support for sqlite, mysql, and postgresql Authentication via JWT Support for sqlite, mysql, and postgresql Support for graph
Express MVC Boilerplate A simple mvc boilerplate for express.js (gulp + expressjs + nodemon + browser-sync) Related modules express - web application framework for node pug - template engine stylus -