Example Node.js backend API and simple frontend for a BUY/SELL exchange.
# Create the image
$ docker-compose build
# Sets up Elastic Search in docker
$ docker-compose up
Jest watches and recompiles typescript files when they are changed.
$ npm test
# Just api tests
$ npm run tests:api
# Just frontend tests
$ npm run tests:frontend
# Elastic Search
http://localhost:9300
# API
http://localhost:3100
# Frontend
http://localhost:3000
After a PR merges into master, Heroku triggers a new build.
POST /order
{
"type": "BUY",
"amount": 10,
"price": 12.50
}
{
"response": "OK"
}
POST /order
{
"type": "SELL",
"amount": 5,
"price": 12.50
}
{
"response": "OK"
}
GET /orders
[
{
"type": "BUY",
"amount": 5,
"price": 12.5
}
]
The data is currently not stored in elastic search, only via an in-memory array. The TradesApi.ts
will need to be modified to add the trades to the array.