当前位置: 首页 > 软件库 > Web应用开发 > >

express-mongodb-rest-api-boilerplate

授权协议 MIT License
开发语言 JavaScript
所属分类 Web应用开发
软件类型 开源软件
地区 不详
投 递 者 隆飞宇
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

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-mail verification, Multi language, Redis for token blacklisting

Package list

Package Description
bcryptjs Optimized bcrypt in JavaScript with zero dependencies. Compatible to the C++ bcrypt binding on node.js and also working in the browser.
cors CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.
crypto-random-string Generate a cryptographically strong random string
dotenv Dotenv is a zero-dependency module that loads environment variables from a .env file into process.env. Storing configuration in the environment separate from code is based on The Twelve-Factor App methodology.
ejs Embedded JavaScript templates
email-templates Create, preview, and send custom email templates for Node.js. Highly configurable and supports automatic inline CSS, stylesheets, embedded images and fonts, and much more! Made for sending beautiful emails with Lad.
express Fast, unopinionated, minimalist web framework for node.
http-status-codes Constants enumerating the HTTP status codes.
i18next i18next is a very popular internationalization framework for browser or any other javascript environment (eg. node.js).
i18next-express-middleware This is a middleware to use i18next in express.js.
ioredis A robust, performance-focused and full-featured Redis client for Node.js.
jsonwebtoken This was developed against draft-ietf-oauth-json-web-token-08. It makes use of node-jws
module-alias Create aliases of directories and register custom module paths in NodeJS like a boss!
moment A lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.
mongoose Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Mongoose supports both promises and callbacks.
nodemailer Send e-mails from Node.js – easy as cake!
validator A library of string validators and sanitizers.
winston A logger for just about everything.

Redis

Mac (using homebrew):

brew install redis

Linux:

sudo apt-get install redis-server

First, we use yarn - workspaces with lerna

Introducing Yarn Workspaces

cd workspaces/api

COPY .env.example to .env

cp .env.example .env

Note: I highly recommend installing nodemon.

nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected.nodemon does not require any additional changes to your code or method of development. nodemon is a replacement wrapper for node, to use nodemon replace the word node on the command line when executing your script.yarn global add nodemon.

API Start

yarn start
yarn start:local # with nodemon

Docker compose

docker-compose up -d --build
docker-compose -f docker-compose.dev.yml up --build # with nodemon

ESlint Start

yarn lint
yarn lint:write # with prefix --fix

API Structure

├─ src
│  ├─ i18next
│  │  ├─ locales
│  │  │  ├─  en.json
│  │  │  └─  ge.json
│  │  └─ index.js
│  ├─ middleware
│  │  ├─ authentication.js
│  │  ├─ authMiddleware.js
│  │  └─  index.js
│  ├─ module
│  │  ├─ auth
│  │  │  ├─ mail
│  │  │  │  ├─ index.js
│  │  │  │  └─ userMail.js
│  │  │  ├─ service
│  │  │  │  ├─ index.js
│  │  │  │  └─ userService.js
│  │  │  ├─ authController.js
│  │  │  ├─ index.js
│  │  │  └─ user.js
│  │  └─ index.js
│  ├─ route
│  │  ├─ auth.js
│  │  └─ index.js
│  ├─ service
│  │  ├─ logger.js
│  │  └─ nodemailer.js
│  ├─ validator
│  │  ├─ index.js
│  │  └─ userValidator.js
│  ├─ view
│  │  └─ template
│  │     ├─ reset-password
│  │     │  └─ html.ejs
│  │     ├─ verify
│  │     │  └─ html.ejs
│  │     └─ verify-request
│  │        └─ html.ejs
│  ├─ index.js
│  ├─ mongoose.js
│  └─ redis.js
├─ .dockerignore
├─ .env.example
├─ .eslintignore
├─ .eslint
├─ .gitignore
├─ Dockerfile
├─ Dockerfile.dev
├─ LICENSE
├─ README.md
├─ docker-compose.dev.yml
├─ docker-compose.yml
└─ package.json

API Endpoints

Note: For any question issues

License

This project is an open-source with an MIT License

  • 一、背景描述: 我在linux RED7上安装了mongodb,并没有修改mongodb的配置文件。然后通过另外一台电脑用pymongo连接mongodb时,报错:timeout。 ping IP 是成功的。 telnet IP 27017 的时候,提示:27017端口连接不上。 二、解决过程: 各种百度,远程连接mongodb失败,网上资料显示原因有两个: 1、mongodb

  • 推荐阅读 MongoDB 资源、库、工具、应用程序精选列表中文版 有哪些鲜为人知,但是很有意思的网站? 一份攻城狮笔记 每天搜集 Github 上优秀的项目 一些有趣的民间故事 超好用的谷歌浏览器、Sublime Text、Phpstorm、油猴插件合集 目录 资源 文档 文章 图书 会谈 教程 更多 库 C C++ C#/.NET Delphi Elixir Erlang Go Haskell

 相关资料
  • API RESTful em Express, Mongoose, Mocha e Chai. Scripts Os seguintes scripts estão disponiveis com yarn run SCRIPT ou npm run SCRIPT Script Descrição test Roda o linter, roda os testes unitários e os

  • 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,

  • Node.js Express API with TypeScript 3 Node.js Express API with TypeScript 3. Supports MongoDB Description This skeleton will help you to build your own Node.js Express Mongodb API using TypeScript 3.

  • Express & ES6 REST API Boilerplate This is a straightforward boilerplate for building REST APIs with ES6 and Express. ES6 support via babel REST resources as middleware via resource-router-middleware

  • Express & mongoose REST API Boilerplate in ES6 with Code Coverage Sponsor You can support the project by checking out our sponsor page. It takes only one click: Overview This is a boilerplate applicat

  • Nodejs Expressjs MongoDB Ready-to-use API Project Structure A ready-to-use boilerplate for REST API Development with Node.js, Express, and MongoDB Getting started This is a basic API skeleton written