# @norest/cli

> A not only REST interface.

Latest version **0.3.6** (published 2021-08-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @norest/cli
pnpm add @norest/cli
yarn add @norest/cli
bun add @norest/cli
```

Provides the command `norest`.

## 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.3.6 |
| Published | 2021-08-18 |
| First published | 2020-09-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 313.4 KB |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Jan Hommes |
| Maintainers | janhommes |

## Links

- npm: https://www.npmjs.com/package/@norest/cli
- Repository: https://github.com/janhommes/noREST
- npm.io page: https://npm.io/package/@norest/cli

## Dependencies (12)

- [rxjs](https://npm.io/package/rxjs.md) ^6.5.4
- [yargs](https://npm.io/package/yargs.md) ^15.3.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [rimraf](https://npm.io/package/rimraf.md) ^3.0.2
- [commander](https://npm.io/package/commander.md) ^5.1.0
- [@nestjs/core](https://npm.io/package/@nestjs/core.md) ^7.0.0
- [@nestjs/common](https://npm.io/package/@nestjs/common.md) ^7.0.0
- [@norest/nestjs](https://npm.io/package/@norest/nestjs.md) ^0.3.0
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13
- [@nestjs/websockets](https://npm.io/package/@nestjs/websockets.md) ^7.0.5
- [@nestjs/platform-ws](https://npm.io/package/@nestjs/platform-ws.md) ^7.0.5
- [@nestjs/platform-express](https://npm.io/package/@nestjs/platform-express.md) ^7.0.0

## Recent versions

- 0.3.6 (latest) — 2021-08-18
- 0.3.5 — 2021-08-18
- 0.3.3 — 2021-05-18
- 0.3.2 — 2021-05-18
- 0.2.8 — 2020-09-23
- 0.2.7 — 2020-09-23
- 0.2.6 — 2020-09-22
- 0.2.5 — 2020-09-22
- 0.2.4 — 2020-09-22
- 0.2.3 — 2020-09-22
- 0.2.0 — 2020-09-22
- 0.1.0 — 2020-09-22
- 0.1.4 — 2020-09-22
- 0.1.3 — 2020-09-22

## README

# Install

Get it from npm:

```
npm i @norest/cli -g
```

# Getting started

Spin up a default server (file system storage):

```
norest
```

## Configuration
Or configure it to your needs:
 - `-p`      = Which port to use (default: `3030`)
 - `--fixed` = Set this to true, to disallow adding new index fragments (default: `false`).
 - `--path`  = The base path to expose the rest api (default: `api`).
 - `--websocket.<<prop>>` = All [configurations for websocket](/blob/master/nestjs/src/websocket/websocket-config.interface.ts).
 - `--rest.<<prop>>`      = All [configurations for the rest interface](/blob/master/nestjs/src/rest/rest-config.interface.ts).
 - `--auth.<<prop>>`      = All [configurations for the authentication](/blob/master/nestjs/src/auth/auth-config.interface.ts).
 - `--connector.<<prop>>` = All [configurations for the file or database connector](/blob/master/nestjs/nestjs/src/connector/connector-config.interface.ts).


Example to start with authentication enabled:
```
norest serve --auth.enabled true
```


Example to start with a Mongo DB:
```
norest serve --connector.name mongodb --connector.url "mongodb://127.0.0.1:27017/test"
```

> Note: NoREST only works with mongodb Sharding, single mongodb nodes are not supported.

## Configuration file
You could also create a .norestrc.json, yaml or .js in the root directory and store/export the configuration there.
```
{
  "connector": {
    "name": "mongodb",
    "url": "mongodb://127.0.0.1:27017/test",
    "collection": "norest",
    "createCollectionNotExisting": true
  },
  "websocket": {
    "enabled": true
  },
  "auth": {
    "cookieName": "auth",
    "userProperty": "sub"   
  },
  "path": "api",
  "fixed": false
}

```

> By default the noREST nestjs implementation supports two connectors: mongoDB and file. File is the default configuration but only suitable for non high load.

## Plugins
Plugins can be added to an Javascript configuration file only. They are based on the module infrastructure of Nestjs. Configuration can be passed to the
calling `register()` function.
``` 
const AuthProxyModule = require('@norest/plugin-auth-proxy').AuthProxyModule;

module.exports = {
  plugins: [AuthProxyModule.register({
    github: {
      client_id: '22e26fceea63a8ace68f',
      redirect_uri: 'http://localhost:3031/github/auth',
      client_secret: 'xyz',
    }
  })]
};
```

There is currently only two official plugin:
 - [@norest/plugin-auth-proxy](/plugins/auth-proxy/README.md): The auth-proxy plugin allows to add an external authentication provider like Github. 
 - [@norest/plugin-faker](/plugins/faker/README.md): A plugin that allows to generate fake data with faker.js


## Env variables
Each of the mentioned configuration can be also be parsed as a ENV var. Use the prefix `NOREST_` and replace dots with underscores then:

```
env.NOREST_AUTH_COOKIENAME = "authorization"
```

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