sailor-module-user
v0.8.3
Published
Module User for Sailor
Downloads
12
Readme
Sailor Module User
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: "[email protected],"
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 protected]
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: "[email protected]",
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'
}