Skip to content

alex-martinez-jativa/restful-api-users

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Users

Restful API to menage users

Endpoints

HTTP methods URI path Description
POST /api/user Register user
POST /api/user/auth User authenticate and retrieve token
GET /api/user Retrieve user on JSON format
GET /api/users Retrieve all users on JSON format
PATCH /api/user Update user fields
PATCH /api/user/password Update user password
DELETE /api/user/delete Delete user

JSON response format

{
  "id": "5eb6525aeb6f612b84d6e674",
  "name": "user",
  "surname": "userName",
  "username": "theUser",
  "email": "user@example.com"
}

Default user schema data fields

const UserSchema = new Schema({
    name: {type: String, required: true, trim: true},
    surname: {type: String, required: true, trim: true},
    username: {type: String, required: true, trim: true},
    email: {type: String, required: true, trim: true},
    password: {type: String, required: true, trim: true},
    createdAt: {type: Date, required: true, default: Date.now()},
    authenticatedAt: {type: Date},
    deactivated: {type: Boolean, default: false}
})

Technologies used in the project

  • Node Js
  • Express Js
  • MongoDB
  • Mongoose
  • JSON Web Token
  • Bcrypt
  • Testing:
    • Mocha
    • Chai

About

Restful API to menage users

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published