Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/david-mwas/zentalk-backend
https://github.com/david-mwas/zentalk-backend
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/david-mwas/zentalk-backend
- Owner: David-mwas
- Created: 2024-07-08T16:43:36.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-12-09T05:53:07.000Z (about 2 months ago)
- Last Synced: 2024-12-09T06:30:36.579Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://zentalk-backend.vercel.app
- Size: 48.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ZenTalk-Backend
The backend api for the ZenTalk web application
## Getting started
1. clone the respository
```shell
$ git clone https://github.com/David-mwas/zentalk-backend.git
$ cd zentalk-backend
$ touch .env
```
2. Add the following variables to the .env file
```
PORT = [port your that your will run on]
mongoDbUrl = [mongodburl]
mongoDbName = [name of the database]
AccessTokenSecretKey = [random string ]
AccessTokenExpires = [the time before which the access token should expire eg 1h or 1d or 7d]
```## Registration
> **request**
- url: https://zentalk-backend.vercel.app/api/v1/auth/register
- method: POST
- example of a request body:
```json
{
"username": "Antony",
"email": "[email protected]",
"password": "password",
"confirm_password": "password"
}
```
> **response*** status code: `201` if success else `400`
* response body:```json
"status": "success",
"message": "user registerd successfully",
```## Login
> **request**
- url: https://zentalk-backend.vercel.app/api/v1/auth/login
- method: POST
- request body:
```json
"email": "string"
"password": "string"
```
> **response**
- status code: `200` if success else `401`
- response body:```json
"status": "success",
"access_token": "",
```## Get Profile
> **request**
- url: https://zentalk-backend.vercel.app/api/v1/user/profile
- method: GET> **response**
- status code: `200`
- example of a response body:```json
"username": "maich",
"email": "[email protected]",
```## Edit Profile
> **request**
- url: https://zentalk-backend.vercel.app/api/v1/user/edit-profile
- method: POST* request body:
```
username: string optional
email: string optional
password: string optional
confirm_password: ref(password)
```> **response**
- status code: `200`
- response body:```json
"first_name": "maich",
"last_name": "magode",
"email": "[email protected]",
```## Forget Password
> **request**
- url: https://zentalk-backend.vercel.app/api/v1/user/forget-password
- method: POST* request body:
```
email: string
```> **response**
- status code: `200`
- response body:```json
"success": "change password link sent to the user email",
```- `Forgot password` email is sent to the user with a token as a query param
## Reset Password
> **request**
- url: https://zentalk-backend.vercel.app/api/v1/user/reset-password
- method: GET* query params:
```
token: string
```
```json
example of a url: https://zentalk-backend.vercel.app/api/v1/auth/reset-password?token="random string"
```> **response**
- status code: `200`
- response body:```json
"email": "users email",
```- `User email` is sent to the frontend if the token was valid.
## Reset Password
> **request**
- url: https://zentalk-backend.vercel.app/api/v1/user/reset-password
- method: POST* query params:
```
token: string
```
* request body :```json
{
"password": "The new password",
"email": "users email"
}
```> **response**
- status code: `200`
- response body:```json
"success": "password set successfully",
```