# ember-cli-rest-api-blueprint

> Ember CLI blueprint addon for a DS.RESTAdapter compatible REST API

Latest version **0.0.2** (published 2014-07-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install ember-cli-rest-api-blueprint
pnpm add ember-cli-rest-api-blueprint
yarn add ember-cli-rest-api-blueprint
bun add ember-cli-rest-api-blueprint
```

## 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.0.2 |
| Published | 2014-07-02 |
| First published | 2014-07-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Author | Manuel Mitasch |
| Maintainers | manuelmitasch |
| Keywords | ember-addon |

## Links

- npm: https://www.npmjs.com/package/ember-cli-rest-api-blueprint
- Repository: https://github.com/manuelmitasch/ember-cli-rest-api-blueprint
- Issues: https://github.com/manuelmitasch/ember-cli-rest-api-blueprint/issues
- npm.io page: https://npm.io/package/ember-cli-rest-api-blueprint

## Recent versions

- 0.0.2 (latest) — 2014-07-02
- 0.0.0 — 2014-07-02

## README

Warning: currently only works with ember-cli master until it's version is > 0.0.37


Ember CLI Addon: REST API (compatible with DS.RESTAdapter)
==================================================

This [Ember CLI](https://github.com/stefanpenner/ember-cli) addon provies a `rest-api` blueprint that is compatible with the Ember Data DS.RESTAdapter.

It creates express routes in 'server/routes/' that are then automatically served through the `ember serve` command.


Usage
-------

To create a REST API for a model called `post` type:

```
ember generate rest-api post
```

The REST API is namespaced with `/api` to avoid route collisions with the routes defined in your Ember app. Thus, it can be accessed through:

```
0.0.0.0:4200/api/posts
```


Dependencies
------------

The generated REST API depends on

* [nedb](https://github.com/louischatriot/nedb): a very simple database
* [ember-inflector-node-shim](https://github.com/manuelmitasch/ember-inflector-node-shim): a shim to use ember-inflector (to pluralize the modelname)

Thus, you need to add these dependencies to your project with:

```
npm install nedb --save
npm install git://github.com/manuelmitasch/ember-inflector-node-shim --save
```


How to persist database records?
--------------------------------

By default the generated REST route uses [nedb](https://github.com/louischatriot/nedb) as a in-memory store. Thus, all changes are lost after you restart the server.

To persist the data you can specify a filename when creating the `db` object:

```
db = new Datastore({ filename: 'path/to/datafile', autoload: true });
```



Roadmap
-------

[] Add a post-install script that adds the dependencies to the ember app.

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