BTCUSDT price synchronizer.
A server app which periodically fetch the BTCUSDT price into database and exposes api with exchange rate history and current rate.
Host: http://localhost:3000
- Run with Docker
docker compose build
docker compose up
- Run NodeJS app
Run PostgreSQL in Docker
docker run -it --env-file .env -v $(pwd)/db:/var/lib/postgresql/data --rm --name db -p 5432:5432 postgres:15
$ npm install
# development
$ npm run start
# watch mode
$ npm run start:dev
Playground: http://localhost:3000/graphql
mutation($username: String!, $password: String!) {
login(username: $username, password: $password) {
access_token
}
}
QUERY VARIABLES
{
"username": "guest",
"password": "guest"
}
Use access_token
(Bearer token) for API requests with "Authorization" HTTP header.
query($currency: String!, $skip: Int!, $take: Int!) {
currencies(currency: $currency, skip: $skip, take: $take) {
currency
price
createdAt
}
}
QUERY VARIABLES
{
"currency": "BTCUSDT",
"skip": 0,
"take": 3
}
HTTP HEADERS
{
"Authorization": "Bearer [access_token]"
}
query($currency: String!) {
currencyPrice(currency: $currency)
}
QUERY VARIABLES
{
"currency": "BTCUSDT"
}
HTTP HEADERS
{
"Authorization": "Bearer [access_token]"
}
# unit tests
$ npm run test
# test coverage
$ npm run test:cov
Nest is MIT licensed.