Skip to content

hboylan/express-mongoose-api-seed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 project. Use it to host an ExpressJS API using MongooseJS.

Remove this for your project

Routes

Notes

  • @session_role
  • @body = POST param
  • @param = URL param /user/:param
  • (options)
Method Endpoint Action
POST /user Create User
POST /:role/login Login User
POST /user/logout Logout User
PUT /user/password Update Password
GET /user/auth Auth User
GET /:role\s List Users
GET /user/:uid Show User
DELETE /user Delete User

### User Routes #### Create User Create new user
  • @body email
  • @body password (8 - 20 chars, 1+ digit)
  • @body name
  • @body role (user|admin)
#### Login User Create user session
  • @body email
  • @body password

Same as Show User

#### Logout User

Destroy user session

#### Update Password

Update user password

#### Auth User Check if session is valid #### List Users List all user with role
  • @param role (user|admin)
#### Show User Show user info
  • @param uid
#### Delete User Remove user
  • @body password
Mongoose connection opened: mongodb://localhost/db-development
Nomadic Fitness API running at http://192.168.1.106:8000
POST /user 200 207ms - 118b
POST /client/login 200 94ms - 118b
GET /user/auth 200 5ms
PUT /user/password 200 6ms - 118b
DELETE /user 200 3ms - 33b

Testing http://localhost:8000

POST /user
{
  "email": "[email protected]",
  "password": "password1",
  "name": "Hugh Boylan"
}
RESPONSE: [200]
{
  "email": "[email protected]",
  "name": "Hugh Boylan",
  "_id": "532bc0a42a185f2438000002",
  "role": "client"
}

POST /client/login
{
  "email": "[email protected]",
  "password": "password1"
}
RESPONSE: [200]
{
  "email": "[email protected]",
  "name": "Hugh Boylan",
  "_id": "532bc0a42a185f2438000002",
  "role": "client"
}

GET /user/auth
{}
RESPONSE: [200]
null

PUT /user/password
{
  "password": "password2"
}
RESPONSE: [200]
{
  "_id": "532bc0a42a185f2438000002",
  "email": "[email protected]",
  "name": "Hugh Boylan",
  "role": "client"
}

DELETE /user
{
  "password": "password2"
}
RESPONSE: [200]
{
  "error": "Invalid password"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published