Skip to content

Latest commit

 

History

History
192 lines (122 loc) · 2.28 KB

README.md

File metadata and controls

192 lines (122 loc) · 2.28 KB

Description

Microservices running through containers using NestJS backend

Installation

Clone this repo.

Add values on .env.example and rename it to .env

Install Docker

run docker-compose up

access localhost:3001/docs on a web browser

Run tests

services test:

npm run test

e2e tests:

npm run test:e2e

API Service description

Version 1.0

API Service for querying stocks.

Path Table

Method Path Description
POST /register Register user email and role, returns the same email and access token.
POST /reset-password Reset password and send it by email.
GET /stock Query stocks like aapl.us, return stock information. Must be authenticated.
GET /history Get User history based on Auth Bearer Token.
GET /stats Super-users can get the top 5 queried stocks.

Path Details


[POST]/register

RequestBody

  • application/json
{
  email: string
  role: string
}

Responses

  • 201 User created successfully

application/json

{
  email: string
  access_token: string
}
  • 400 User already exists

[POST]/reset-password

RequestBody

  • application/json
{
  email: string
}

Responses

  • 200 Password reset email sent

  • 400 Invalid query

  • 401 User not found


[GET]/stock

  • Security
    bearer

Parameters(Query)

q: string

Responses

  • 200

application/json

{
  name: string
  symbol: string
  open: number
  close: number
  high: number
  low: number
}
  • 400 Missing query parameter

  • 401 Unauthorized

  • 404 Stock not found


[GET]/history

  • Security
    bearer

Responses

  • 200

application/json

{
  date: string
  name: string
  symbol: string
  open: number
  close: number
  high: number
  low: number
}[]
  • 401 Unauthorized

[GET]/stats

  • Security
    bearer

Responses

  • 200

application/json

{
  stock: string
  times_requested: number
}[]
  • 401 Super-users only

Stock Service description

Version 1.0

API Service for querying stocks.

Path Table

Method Path Description
GET / Fetches stock information from stooq