Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cedric921/dga-chat-mearn-socket-backend
An api for a real time chat in express, socket.io, mongo, ts in backend and next, redux toolkit in frontend
https://github.com/cedric921/dga-chat-mearn-socket-backend
cloudinary joi mongodb mongoose multer typescript
Last synced: about 1 month ago
JSON representation
An api for a real time chat in express, socket.io, mongo, ts in backend and next, redux toolkit in frontend
- Host: GitHub
- URL: https://github.com/cedric921/dga-chat-mearn-socket-backend
- Owner: Cedric921
- License: mit
- Created: 2022-11-02T13:01:24.000Z (about 2 years ago)
- Default Branch: dev
- Last Pushed: 2023-01-23T12:32:06.000Z (almost 2 years ago)
- Last Synced: 2023-03-03T21:37:03.342Z (almost 2 years ago)
- Topics: cloudinary, joi, mongodb, mongoose, multer, typescript
- Language: TypeScript
- Homepage: https://gda-chat-socket.onrender.com
- Size: 10 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dga-chat-mearn-socket-backend
### By cedric karungu
An api for a real time chat in express, socket.io, mongo, ts in backend and next, redux toolkit in frontend
base url
```
http://gda-chat-socket.onrender.com
```This api has to modules
- Users module
- Messages module# 1. Users
to endpoint to send or to receive message user must have a valid token, we suppose that user is connected if user ( client ) have a valid token
## 1.1 Create an account
endpoint
```
http://gda-chat-socket.onrender.com/api/users/signup
```Body request
```
{
"name": "Dieume",
"lastname":"Muhindo",
"email":"[email protected]",
"password": "123456",
"username":"dieume"
}
```Response
```
{
"_id": "638db1d294adce5b3016c466",
"name": "Dieume",
"lastname": "Muhindo",
"email": "[email protected]",
"username": "dieume",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYzOGRiMWQyOTRhZGNlNWIzMDE2YzQ2NiIsImlhdCI6MTY3MDIzMDQ4MiwiZXhwIjoxNjcwMzE2ODgyfQ.LLepTCWyHexlC2nvWzFSvvfI6oOcsDJh_Yec08pbYkU"
}
```## 1.2 Login
if user has an account, any time you can login to get a valid access token
endpoint
```
http://gda-chat-socket.onrender.com/api/users/login
```Body request
```
{
"username": "vb",
"password": "123456"
}
```Response
```
{
"_id": "6362e15b48125878c5770b19",
"name": "Cedric",
"lastname": "karungu",
"email": "[email protected]",
"username": "vb",
"imageUrl": "https://res.cloudinary.com/dteyspzef/image/upload/v1669025861/lmfeh22cbkyudcfv7mml.jpg",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYzNjJlMTViNDgxMjU4NzhjNTc3MGIxOSIsImlhdCI6MTY3MDIzMDcyMiwiZXhwIjoxNjcwMzE3MTIyfQ.8Uzdw3H2J1-t1HKK8EEgA5d1r0Dlo1Nz-sbBRoC5PD0"
}
```