# express-mongoose-api-seed

> - - - ###### *Remove this for your project*

Latest version **0.1.1** (published 2014-02-25) · 0 weekly downloads

## Install

```sh
npm install express-mongoose-api-seed
pnpm add express-mongoose-api-seed
yarn add express-mongoose-api-seed
bun add express-mongoose-api-seed
```

## 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.1.1 |
| Published | 2014-02-25 |
| First published | 2014-02-25 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+14 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 28 |
| Maintainers | hjboylan |

## Links

- npm: https://www.npmjs.com/package/express-mongoose-api-seed
- Repository: git@github.com:hboylan/express-mongoose-api-seed
- Issues: https://github.com/hboylan/express-mongoose-api-seed/issues
- npm.io page: https://npm.io/package/express-mongoose-api-seed

## Dependencies (6)

- [vows](https://npm.io/package/vows.md) ~0.7.0
- [bcrypt](https://npm.io/package/bcrypt.md) ~0.7.7
- [express](https://npm.io/package/express.md) ~3.4.8
- [api-easy](https://npm.io/package/api-easy.md) ~0.3.8
- [mongoose](https://npm.io/package/mongoose.md) ~3.8.4
- [connect-mongo](https://npm.io/package/connect-mongo.md) ~0.4.0

## Recent versions

- 0.1.1 (latest) — 2014-02-25
- 0.0.2 — 2014-02-25
- 0.0.1 — 2014-02-25

## README

# express-mongoose-api-seed

- - - 
###### *Remove this for your project*

## Description

This project provides an organized application directory structure from which you can begin your [NodeJS](http://nodejs.org/) project. Use it to host an [ExpressJS](http://expressjs.com/api.html) API using [MongooseJS](http://mongoosejs.com/).

## File structure

* **/app.js:** Load and serve API resources

* **/controllers:** Contains API endpoint controllers

* **/lib:** Contains NodeJS helpers
  * **/lib/config.json:** Configuration info for port, DB, session, etc.

  * **/lib/settings.js:** API settings

  * **/lib/database.js:** Mongoose connection helper

  * **/lib/routes.js:** API endpoints

  * **/lib/utils.js:** API helper functions

* **/models:** Contains Mongoose models
  * **/models/index.js:** Declare models to use

  * **/models/user.js:** User model schema declaration

* **/public:** ExpressJS will statically serve this directory, *served from memory*

* **/tests:** Vows test files
  * **/tests/data.json:** Test data

  * **/tests/user-test.js:** Create, login, logout, remove user

###### *Remove this for your project*
- - - 

## Routes
>### *Notes*
>* *@session_role*
>* @body   = POST param 
>* @param = URL param /user/:param 
>* (options)

### [User](#user-routes)
 Method        | Endpoint                  | Action 
-------------  | ------------------------- | -----------------------------------------
`POST`         | /user                     | [Create User](#create-user)
`POST`         | /user/login               | [Login User](#login-user)
`POST`         | /user/logout              | [Logout User](#logout-user)
`GET`          | /user/auth                | [Auth User](#auth-user)
`GET`          | /user/:role               | [List Users](#list-users)
`GET`          | /user/:uid                | [Show User](#show-user)
`DELETE`       | /user/:uid                | [Delete User](#delete-user)

- - -

<a name="user-routes">
### User Routes

<a name="create-user">
#### Create User
Create new user

- @body email 
- @body password (8 - 20 chars, 1+ digit) 
- @body first 
- @body last 
- *@body role (user|admin)*
```json
{
    "_id": "5307a99ed5539300005a665d",
    "username": "hjboylan",
    "name": "Hugh Boylan",
    "role": "user"
}
```


<a name="login-user">
#### Login User
Create user session

- @body email  
- @body password

Same as [Show User](#show-user)


<a name="logout-user">
#### Logout User

Destroy user session 

<a name="auth-user">
#### Auth User
Check if session is valid  


<a name="list-users">
#### List Users
List all user with role

- @param role (user|admin)
```json
[
    {
        "_id": "5307a99ed5539300005a676e",
        "username": "thinkerton",
        "name": "John Barnack",
        "role": "admin"
    }
]
```


<a name="show-user">
#### Show User
Show user info

- @param uid
```json
{
    "_id": "5307a99ed5539300005a665d",
    "username": "hjboylan",
    "name": "Hugh Boylan",
    "role": "user"
}
```


<a name="delete-user">
#### Delete User
Remove user

- @body password

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