【文件属性】:
文件名称:expressjs-api-example:使用 Node.js、Express 和 MongoDB 构建 RESTful API 的示例
文件大小:55KB
文件格式:ZIP
更新时间:2021-05-30 07:54:44
JavaScript
Expressjs + MongoDB API 示例
使用 Node.js、Express 和 MongoDB 构建 RESTful API 的入门项目
特征
ES2017 最新特性,如 Async/Await
启用 CORS
使用
Express + MongoDB()
使用设置一些 HTTP 标头以确保安全
使用从.env文件加载环境变量
要求验证
带Gzip
用
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:w
【文件预览】:
expressjs-api-example-main
----.eslintrc(361B)
----package.json(2KB)
----.prettierrc(73B)
----.env.example(77B)
----src()
--------models()
--------serializers()
--------config()
--------index.js(1KB)
--------routes()
--------tests()
--------controllers()
--------validations()
--------services()
--------utils()
--------middlewares()
----.gitignore(673B)
----README.md(1KB)
----yarn.lock(126KB)