# node-rem

> Node REM - NodeJS Rest Express MongoDB and more: typescript, passport, JWT, socket.io, HTTPS, HTTP2, async/await, etc.

Latest version **0.6.2** (published 2019-02-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-rem
pnpm add node-rem
yarn add node-rem
bun add node-rem
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.2 |
| Published | 2019-02-28 |
| First published | 2019-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 32 |
| Unpacked size | 401.1 KB |
| Known vulnerabilities | 0 (+71 in 8 direct dependencies) |
| Install scripts | yes |
| GitHub stars | 247 |
| Author | Duc Nguyen |
| Maintainers | ngduc |
| Keywords | rem, express, node, node.js, mongodb, mongoose, passport, es6, es7, es8, es2017, mocha, istanbul, nyc, eslint, Travis CI, coveralls, REST, API, boilerplate, generator, starter project, typescript, tslint |

## Links

- npm: https://www.npmjs.com/package/node-rem
- Repository: https://github.com/ngduc/node-rem
- Homepage: https://github.com/ngduc/node-rem#readme
- Issues: https://github.com/ngduc/node-rem/issues
- npm.io page: https://npm.io/package/node-rem

## Dependencies (32)

- [joi](https://npm.io/package/joi.md) ^14.3.1
- [pm2](https://npm.io/package/pm2.md) ^3.3.1
- [cors](https://npm.io/package/cors.md) ^2.8.5
- [spdy](https://npm.io/package/spdy.md) ^4.0.0
- [uuid](https://npm.io/package/uuid.md) ^3.3.2
- [axios](https://npm.io/package/axios.md) ^0.18.0
- [helmet](https://npm.io/package/helmet.md) ^3.15.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [morgan](https://npm.io/package/morgan.md) ^1.9.1
- [mstime](https://npm.io/package/mstime.md) ^0.6.4
- [multer](https://npm.io/package/multer.md) ^1.4.1
- [express](https://npm.io/package/express.md) ^4.16.4
- [bcryptjs](https://npm.io/package/bcryptjs.md) 2.4.3
- [bluebird](https://npm.io/package/bluebird.md) ^3.5.3
- [mongoose](https://npm.io/package/mongoose.md) ^5.4.16
- [passport](https://npm.io/package/passport.md) ^0.4.0
- [cross-env](https://npm.io/package/cross-env.md) ^5.2.0
- [socket.io](https://npm.io/package/socket.io.md) ^2.2.0
- [handlebars](https://npm.io/package/handlebars.md) ^4.1.0
- [jwt-simple](https://npm.io/package/jwt-simple.md) 0.5.5
- [nodemailer](https://npm.io/package/nodemailer.md) ^5.1.1
- [body-parser](https://npm.io/package/body-parser.md) ^1.18.3
- [compression](https://npm.io/package/compression.md) ^1.7.3
- [dotenv-safe](https://npm.io/package/dotenv-safe.md) ^6.1.0
- [http-status](https://npm.io/package/http-status.md) ^1.3.1
- [passport-jwt](https://npm.io/package/passport-jwt.md) 4.0.0
- [@slack/client](https://npm.io/package/@slack/client.md) ^4.10.0
- [method-override](https://npm.io/package/method-override.md) ^3.0.0
- [moment-timezone](https://npm.io/package/moment-timezone.md) ^0.5.23
- [express-validation](https://npm.io/package/express-validation.md) ^1.0.2
- [passport-http-bearer](https://npm.io/package/passport-http-bearer.md) ^1.0.1
- [nodemailer-mailgun-transport](https://npm.io/package/nodemailer-mailgun-transport.md) ^1.4.0

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [@temporal-architect/claude-plugin](https://npm.io/package/@temporal-architect/claude-plugin.md) — 335 weekly downloads

## Recent versions

- 0.6.2 (latest) — 2019-02-28
- 0.6.0 — 2019-02-28
- 0.5.6 — 2019-02-27
- 0.5.5 — 2019-02-26
- 0.5.0 — 2019-02-22

## README

# Node REM

NodeJS Rest Express MongoDB

[![Build Status](https://travis-ci.org/ngduc/node-rem.svg?branch=master)](https://travis-ci.org/ngduc/node-rem) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/6fac8568bab841b89cc5c17f6c4133d5)](https://www.codacy.com/app/ducjava/node-rem?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=ngduc/node-rem&amp;utm_campaign=Badge_Grade)

🌟 It rains ~~cats and dogs~~ features:

```
  Typescript      Express 4.15       CORS     Helmet    DotEnv   joi (validation)   forever
  Mongoose 4.9    Passport  JWT      Await
  Tslint          Apidoc    Docker   Husky    Morgan    Travis
  Tests
            Mocha  Chai     Sinon    istanbul
  MORE:
            HTTPS           HTTP2 (spdy)      Socketio 2.1       Slack message
            Nodemailer      Mailgun           Email Templates    File upload (multer)
            VSCode Debug    Dependabot        Codacy
      API
            API response    (data, meta: limit, offset, sort)    Transform res
            apiJson         Pagination query      Whitelist fields in response
            mstime          API response time     Stack trace in Response
```
  - More details in [Feature Documentation](src_docs/features.md)
  - If you don't want Typescript, use this branch: `node-rem-without-typescript`

### 📦 Installation

Clone this project:
```
git clone https://github.com/ngduc/node-rem.git your-app
cd your-app
rm -rf .git
yarn
```
- Update `package.json` and `.env` file with your information.
- Run `yarn dev`, it will create a new Mongo DB "node-rem"
- Verify: use Postman to POST https://localhost:3009/v1/auth/register to create a new user. (set payload to have email, password)

### 🔧 Commands

Require: `MongoDB` and `NodeJS v8.12.0 +`

```
yarn dev      launch DEV mode
yarn start    launch PROD mode
yarn stop

yarn test     Run tests
```

### 📖 Features

Your simple `API Route Handler` will have a nice syntax like this: (packed with ~~vitamins~~ cool stuffs)
```js
exports.list = async (req: Request, res: Response, next: NextFunction) => {
  try {
    const data = (await User.list(req)).transform(req); // query & run userSchema.transform() for response
    apiJson({ req, res, data, model: User }); // return standard API Response
  } catch (e) {
    next(e);
  }
};
```

API Response is similar to [JSON API](http://jsonapi.org/examples/#pagination) standard:

```js
GET https://localhost:3009/v1/users?fields=id,name (get id & name only in response)
GET https://localhost:3009/v1/users?role=admin&page=1&perPage=20 (query & pagination)
GET https://localhost:3009/v1/users?role=admin&limit=5&offset=0&sort=email:desc,createdAt
{
    "meta": {
        "limit": 5,
        "offset": 0,
        "sort": {
            "email": -1,
            "createdAt": 1
        },
        "totalCount": 4,
        "timer": 3.85,
        "timerAvg": 5.62
    },
    "data": [
        {
            "id": "5bad07cdc099dfbe49ef69d7",
            "name": "John Doe",
            "email": "john.doe@gmail.com",
            "role": "admin",
            "createdAt": "2018-09-27T16:39:41.498Z"
        },
        // more items...
    ]
}
```
Example of generated API Docs (using `apidoc`) - https://node-rem.netlify.com

### 📖 Documentation

- [Feature Documentation](src_docs/features.md)
- [Build System](src_docs/build.md)
- [Dependencies Notes](src_docs/dependencies.md)
- [Change Log](CHANGELOG.md)

### 🙌 Thanks

All contributions are welcome!

[danielfsousa/express-rest-es2017-boilerplate](https://github.com/danielfsousa/express-rest-es2017-boilerplate)

---
_Source: https://npm.io/package/node-rem · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
