Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/omarkhairy21/vending-machine-api


https://github.com/omarkhairy21/vending-machine-api

Last synced: about 6 hours ago
JSON representation

Awesome Lists containing this project

README

        

## Description

This is a simple Vending Machine API that allows users to buy products and get change back.

## Tech Stack

- NestJS
- TypeORM
- SQLite

# System Requirements

- Node.js: v18
- Yarn: v1.22.5

## Api Documentation

Docs can be found at https://vending-machine-api.fly.dev/api

Note: On API I assumed endpoints get products and users allowed to be public, but in a real scenario, they should be private.

## Authentication

1. You need to create a user first using endpoint POST /users.
2. Use endpoint POST /auth/login to get a token.
3. Add the token on swagger Authorize button.

## Installation with Docker

1. Build the image

```bash
docker build -f "Dockerfile.dev" -t vendingmachineapi-dev:latest "."
```

2. Run the container

```bash
docker run -p 3000:3000 vendingmachineapi-dev:latest
```

## Installation without Docker

```bash
$ yarn install
```

## Running the app

```bash
# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod
```

## Test

```bash
# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov
```