Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jrsousadev/live-chat-api
π¬ Live chat with Websocket, Nodejs, Prisma and Jest
https://github.com/jrsousadev/live-chat-api
backend jest mongodb nodejs prisma socket-io supertest websocket
Last synced: about 2 months ago
JSON representation
π¬ Live chat with Websocket, Nodejs, Prisma and Jest
- Host: GitHub
- URL: https://github.com/jrsousadev/live-chat-api
- Owner: jrsousadev
- Created: 2022-11-19T22:26:30.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-04T02:35:24.000Z (about 2 years ago)
- Last Synced: 2024-11-08T12:42:34.401Z (2 months ago)
- Topics: backend, jest, mongodb, nodejs, prisma, socket-io, supertest, websocket
- Language: TypeScript
- Homepage:
- Size: 285 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## πΊ Live chat project API using mongodb, nodejs, prisma, supertest and jest
API Desenvolvida para ser consumida no live-chat-web
## O que foi utilizado no projeto
- [x] Typescript
- [x] Express
- [x] MongoDB
- [x] Mocks
- [x] Supertest
- [x] Jest
- [x] Prisma
- [x] Nodejs### Regras de negΓ³cio
- [x] Create message
- [x] Get message
- [x] Get last message by chat
- [x] Get all messages by chat
- [x] Delete all messages
- [x] Create chat
- [x] Create group chat
- [x] Get all chats by user
- [x] Get chat
- [x] Create user
- [x] Get user### Endpoints Message
- [x] [POST] "/api/message"
- [x] [GET] "/api/message/chat/:chatId"
- [x] [GET] "/api/message/lastMessage/:chatId"
- [x] [GET] "/api/message/:id"
- [x] [DELETE] "/api/message/all"### Endpoints Chat:
- [x] [POST] "/api/chat"
- [x] [POST] "/api/chat/group"
- [x] [GET] "/api/chat/user/:userId"
- [x] [GET] "/api/chat/:id"### Endpoints Use:
- [x] [POST] "/api/user"
- [x] [GET] "/api/user/:id"### Arquitetura do Projeto
```
.
βββ prisma
βββ src/
β βββ app
β βββ modules
β βββ repositories
β βββ utils
β βββ shared
β βββ errors
β βββ routes
β βββ app.ts
β βββ server.ts
β βββ websocket.ts
β βββ config
β βββ database
β βββ domain
β βββ entities
βββ tests/
β βββ _database
β βββ _modules
β βββ _repositories
β βββ _seed
βββ ...
```### Iniciando o Projeto
- Clone o repositΓ³rio e instale as dependΓͺncias.
```sh
# install dependencies
> npm i# copy .env file
> cp .env.example .env# Generating mongoDB with prisma models
> npm prisma generate# Init tests
> npm run test# start project
> npm run dev# open in
http://localhost:8080/
```