Auth
This documentation covers all endpoints related to authentication functions.
Endpoints
Register
- Method: POST
- URL:
http://localhost:3000/register - Body: Raw (JSON)
{ "email": "your_email", "passwordHash": "your_password", "displayName": "your_display_name" }
Login
- Method: POST
- URL:
http://localhost:3000/login - Body: Raw (JSON)
{ "email": "your_email", "password": "your_password" }
Logout
- Method: GET
- URL:
http://localhost:3000/logout
Send Email Verification Mail
- Method: POST
- URL:
http://localhost:3000/send-verification - Body: Raw (JSON)
{ "email": "your_email" }
Email Verification
- Method: GET
Send Password Reset
- Method: POST
- URL:
http://localhost:3000/send-password-reset - Body: Raw (JSON)
{ "email": "your_email" }
Password Reset
- Method: POST
- URL:
http://localhost:3000/password-reset - Body: Raw (JSON)
{ "currentPassword": "your_password", "newPassword": "your_new_password" }
Get All Users
- Method: GET
- URL:
http://localhost:3000/users
Get User
- Method: GET
- URL:
http://localhost:3000/user/your_id
Update User
- Method: PUT
- URL:
http://localhost:3000/user/your_id - Body: Raw (JSON)
{ "displayName": "your_display_name" }
Create User
- Method: POST
- URL:
http://localhost:3000/user - Body: Raw (JSON)
{ "email": "your_email", "displayName": "your_display_name", "passwordHash": "your_password" }
Delete User
- Method: DELETE
- URL:
http://localhost:3000/user/your_id
Get Current User
- Method: GET
- URL:
http://localhost:3000/current-user
Update Current User
- Method: PUT
- URL:
http://localhost:3000/current-user - Body: Raw (JSON)
{ "displayName": "your_display_name" }
Custom Endpoints
It's important to note that this is a barebones not specific auth backend, you can customize it all you want easily!
You can add a new endpoint in the authRoutes.ts file as following:
authRoutes.ts
router.get("/custom_endpoint", handleSomthing)You can customize your handleSomthing function inside of the authConroller.ts file as the following:
authController.ts
export async function handleSomthing(req: Request, res: Response) {
//Logic here...
}