This repo is a starter kit for Node based REST services and comes with APIs to create & login users with Redis backed sessions
You can add the APIs specific to your application under /lib/api
The user and session related APIs are under /lib/auth
###Create new user
####POST /user
Request
{
"username":"hashbrown",
"password":"saltedhashbrown",
"name":"Salted Hashbrown",
"email": "[email protected]"
}
Response
{
"status": "Successfully registered user"
}
###Get details of currently logged in user
####GET /user
Response
{
"user": {
"name": "Saik",
"username": "saikrishnan",
"email": "[email protected]"
}
}
###Delete currently logged in user
####DELETE /user
Response
{
"status": "Deleted user successfully"
}
###Login user and create new session
####POST /session
Request
{
"username":"hashbrown",
"password":"saltedhashbrown"
}
Response
{
"status": "Logged in successfully"
}
###Logout current user and delete session
####DELETE /session
Response
{
"status": "Logged out successfully"
}
- node.js >= v0.10.29
- mongodb >= 2.4.6
- redis >= 2.0.0
Clone the repository and install all dependencies,
npm install
Add new APIs under /lib/api
Start the app
node app
Mocha is used for BDD style testing
Tests for the user & session API and sample tests for the app are located under /test directory
To run the tests execute the following under the root directory
mocha