Skip to content

Ferhatduran55/usermanagement-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

User Management API

Overview:

This repository comes with methods for adding, updating, deleting, and displaying users to manage user management. Each addition creates a unique key with uuidv4, which is assigned under an object with its corresponding values. You can use the unique id generated by uuidv4 to perform subsequent add, delete, update, and display operations.

Setup:

To set up the project, follow these steps:

  • Copy the .env.example file and rename it to .env.
  • Edit the properties in the .env file as follows:
    • Set the APP_NAME property to your application name.
    • Set the APP_PORT property to the port you want your application to run on.

Usage

To use the User Management API, follow these steps:

  1. Install the required dependencies by running npm install.
  2. Copy the .env.example file and rename it to .env.
  3. Open the .env file and set the following values:
APP_NAME=your_app_name
APP_PORT=your_app_port
  1. Start the server by running npm start.

  2. To add a new user(s):

/users/insert/:prop=:val;:prop2=:val2;..
/users/insert/:prop=:val;:prop2=:val2;../:prop3=:val3;:prop4=:val4;../..

Examples:

/users/insert/username=JohnDoe;password=123456
/users/insert/username=JohnDoe;password=123456;country=US/username=MarryJane;password=987654;[email protected];phone=555-55-55-555

Responses:

{
  "91cfda5f-dc12-43d0-91d5-215e0616bc82":{
    "username":"JohnDoe",
    "password":"123456",
    "country":"US"
  },
  "7aef0ba8-f166-4b23-9cc1-d5ade5ce0ef4":{
    "username":"MarryJane",
    "password":"987654",
    "email":"[email protected]",
    "phone":"555-55-55-555"
  }
}
  1. To get a list of all users:
/users

Response:

{
  "91cfda5f-dc12-43d0-91d5-215e0616bc82":{
    "username":"JohnDoe",
    "password":"123456",
    "country":"US"
  },
  "7aef0ba8-f166-4b23-9cc1-d5ade5ce0ef4":{
    "username":"MarryJane",
    "password":"987654",
    "email":"[email protected]",
    "phone":"555-55-55-555"
  }
}
  1. To get a specific user by ID:
/users/:id

Example:

/users/91cfda5f-dc12-43d0-91d5-215e0616bc82

Response:

{
  "username":"JohnDoe",
  "password":"123456",
  "country":"US"
}
  1. To delete a user by ID(s):
/users/:id/delete

or use this but response has all users

/users/delete/:id/:id2/:id3/..
  1. To delete a user's property:
/users/:id/delete/:prop

Example:

/users/91cfda5f-dc12-43d0-91d5-215e0616bc82/delete/country

Response:

{
  "username":"JohnDoe",
  "password":"123456"
}
  1. To update a user's property:
/users/:id/update/:prop/:val

or use this but response has all users

/users/update/:id/:prop=:val;:prop2=:val2;..

Example:

/users/91cfda5f-dc12-43d0-91d5-215e0616bc82/update/password/321456

Response:

{
  "username":"JohnDoe",
  "password":"321456",
  "country":"US"
}
  1. To get a user's property:
/users/:id/:prop

or

/users/:id/show/:prop

Example:

/users/91cfda5f-dc12-43d0-91d5-215e0616bc82/username

Response:

{"username":"JohnDoe"}

Note: Remember to replace your_app_name and your_app_port with your actual application name and port number.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published