node package manager
Loosely couple your services. Use Orgs to version and reuse your code. Create a free org »

sailor-module-user

![](http://i.imgur.com/0W8wQDR.png)

Sailor Module User

Build Status Dependency status Dev Dependencies Status NPM Status Gittip

Module User for Sailor

Install

Install as dependency in your sailor base application:

sailor install sailor-module-user [--save or --save-dev]

API

Basic CRUD

Register new user

POST /user

The minimum information to create a new user is:

{
    email: "user@sailor.com,"
    password: "yourpassword",
    username: "user1"
}

Check the User Model for know the required, optional and the restriction of each field.

Find all Users

GET /user

Find One User

GET /user/:id

You can specified the user that you want to recover in the url by id:

GET /user/1

or create a more specified query using url params:

GET /user/?username=user2&email=user2@sailor.com

Destroy an User

DELETE /user/:id

Authentication

Login

POST /user/login

You can login a user with his username:

{
    identifier: "user2",
    password: "yourpassword"
}

or with the email:

{
    identifier: "user2@sailor.com",
    password: "yourpassword"
}

Logout

GET /user/logout

Relationship

get following or followers users

GET /user/:id/following

or

GET /user/:id/follower

starts follow other User

POST /user/:id/following

with:

{
    follower: 'yourfollowerID'
}

status relationship

GET /user/:id/following/status

with:

{
    follower: 'yourfollowerID'
}

unfollow

DELETE /user/:id/following

with:

{
    follower: 'yourfollowerID'
}