# resting-mongoose

> RESTify Mongoose Models in Express/NodeJS

Latest version **0.2.1** (published 2013-12-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install resting-mongoose
pnpm add resting-mongoose
yarn add resting-mongoose
bun add resting-mongoose
```

## 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.2.1 |
| Published | 2013-12-02 |
| First published | 2013-11-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.6 |
| Dependencies | 6 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Brian Johnson |
| Maintainers | bpanahij |
| Keywords | mongoose, REST, Node.js |

## Links

- npm: https://www.npmjs.com/package/resting-mongoose
- Repository: https://github.com/bpanahij/restgoose
- Issues: https://github.com/bpanahij/restgoose/issues
- npm.io page: https://npm.io/package/resting-mongoose

## Dependencies (6)

- [q](https://npm.io/package/q.md) ~0.9.7
- [express](https://npm.io/package/express.md) *
- [natural](https://npm.io/package/natural.md) ~0.1.24
- [mongoose](https://npm.io/package/mongoose.md) *
- [optimist](https://npm.io/package/optimist.md) ~0.6.0
- [underscore](https://npm.io/package/underscore.md) *

## 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.2.1 (latest) — 2013-12-02
- 0.1.8 — 2013-11-21
- 0.1.7 — 2013-11-15
- 0.1.6 — 2013-11-15
- 0.1.5 — 2013-11-14
- 0.1.4 — 2013-11-14
- 0.1.3 — 2013-11-14
- 0.1.2 — 2013-11-14

## README

resting-mongoose
=========
![alt 'resting mongoose'](http://upload.wikimedia.org/wikipedia/commons/f/f2/Banded_mongoose_arp.jpg)
# Restify Mongoose Models

Making Mongoose models in NodeJS RESTful, by making an Express middleware layer to automatically add REST methods to each model in a directory.


To install just use:

```sh
npm install resting-mongoose
```

You can easily use resting-mongoose like so:

```Javascript
// Connecting to Mongoose at server level
var mongoose = require ('mongoose');
mongoose.connect('mongodb://localhost/my_database');
// Loading restful module
var resting_mongoose = require('resting-mongoose');
/** 
 * Using resting_mongoose middleware at /resources URL,
 * for all models in models directory
 */
app.use('/resources', resting_mongoose(__dirname + '/models'));
```
# Accessing via HTTP

Now, you can access your RESTful model by going to:
```
GET http://localhost/resources/ModelName/:_id
// Queries
GET http://localhost/resources/ModelName/?model_param=10
// Greater than query
GET http://localhost/resources/ModelName/?model_param_2>=20
// Less than query
GET http://localhost/resources/ModelName/?model_param3<=14
// Not equals query
GET http://localhost/resources/ModelName/?model_param_4!=hello
// Look ahead query
GET http://localhost/resources/ModelName/?model_param_5*=Look%20Ahead%20Query
// Limit and offset
GET http://localhost/resources/ModelName/?limit=10&offset=3
// Update
PUT http://localhost/resources/ModelName/:_id
// Create
POST http://localhost/resources/ModelName
// Delete
DELETE http://localhost/resources/ModelName
```

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