https://github.com/avatsaev/angular-contacts-app-example-api
Backend API server for Angular Contacts App
https://github.com/avatsaev/angular-contacts-app-example-api
api docker experss nestjs rest typescript
Last synced: 4 months ago
JSON representation
Backend API server for Angular Contacts App
- Host: GitHub
- URL: https://github.com/avatsaev/angular-contacts-app-example-api
- Owner: avatsaev
- Created: 2017-07-03T02:16:51.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-09-11T12:11:33.000Z (almost 6 years ago)
- Last Synced: 2026-02-01T08:42:25.185Z (5 months ago)
- Topics: api, docker, experss, nestjs, rest, typescript
- Language: TypeScript
- Homepage: https://github.com/avatsaev/angular-contacts-app-example
- Size: 591 KB
- Stars: 61
- Watchers: 4
- Forks: 35
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NestJS Contacts API
This project uses [@nestjsx/crud](https://github.com/nestjsx/crud) to simplify and standardize the REST API
This backend is based on NestJS Framework V6 (https://nestjs.com/)
- DB: Postgres
- Websockets: Socket.io
- Synchronises sockets thourgh Redis adapter for horizontal scaling
**Frontend is available here: https://github.com/avatsaev/angular-contacts-app-example**
## Env VARS:
SERVER_PORT: 3000
POSTGRES_HOST: db
POSTGRES_PORT: 5432
POSTGRES_USER: contacts_db
POSTGRES_PASSWORD: contacts_db_pass
POSTGRES_DB: contacts_db
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_ENABLED: 'true'
## Run
`docker-compose up --build `
Server will be running on http://localhost:3000
# Endpoints
- `GET /contacts` : returns an array of `Contacts`
- `GET /contacts/:id`: returns a `Contact` shape
- `POST /contacts`: Create a contact, returns a `Contact` shape
- `PATCH /contacts/:id`: Partially update a `Contact`, returns a `Contact` shape
- `DELETE /contacts/:id`: Delete a `Contact`, empty response
### Contact shape:
```typescript
interface Contact {
id?: number | string;
name: string;
email: string;
phone?: string;
}
```
## Installation
```bash
$ npm install
```
## Running the app
```bash
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
npm run start:prod
```
## Test
```bash
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
```