harrymt / harry-change

Example React frontend Node.js backend API with Elastic Search

Home Page:https://harry-change.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

image

Harry's Exchange

Example Node.js backend API and simple frontend for a BUY/SELL exchange.

Setup

# Create the image
$ docker-compose build

# Sets up Elastic Search in docker
$ docker-compose up

Tests

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

Development Endpoints

# Elastic Search
http://localhost:9300

# API
http://localhost:3100

# Frontend
http://localhost:3000

Deployment

After a PR merges into master, Heroku triggers a new build.

Api Endpoints

Order

POST /order
{
	"type": "BUY",
	"amount": 10,
	"price": 12.50
}
{
  "response": "OK"
}

Sell

POST /order
{
	"type": "SELL",
	"amount": 5,
	"price": 12.50
}
{
  "response": "OK"
}

List open orders

GET /orders
[
  {
    "type": "BUY",
    "amount": 5,
    "price": 12.5
  }
]

Elastic Search

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.

About

Example React frontend Node.js backend API with Elastic Search

https://harry-change.herokuapp.com/

License:MIT License


Languages

Language:TypeScript 63.9%Language:JavaScript 19.2%Language:HTML 8.6%Language:CSS 7.0%Language:Dockerfile 1.3%