Skip to content

narigondelsiglo/accounting-notebook

Repository files navigation

Accounting notebook

Accounting notebook API REST Service and React Client according to Coding Challenge definitions.

Server based on generator-express-no-stress generator. Client based on simple-react-full-stack

Prerequisites

In order to properly run this project you must have installed Node v8 or newer and GIT

Quick start

Obtain the project

git clone https://github.com/narigondelsiglo/accounting-notebook

Install dependencies and launch both frontend and backend

./launch.sh

With Docker

Install dependencies and launch both frontend and backend

docker build -t accounting-notebook .
docker run -p 5000:5000 -p 3000:3000 --name accounting-notebook -d accounting-notebook

Architecture description

React frontend connection listens on port 3000 NodeJs REST API backend listens on port 5000

Install Dependencies

Install backend dependencies (one time operation):

npm install

Install frontend dependencies (one time operation):

cd client
npm install
cd ..

Run It

Runs the application is development mode. Should not be used for production. In project root directory:

npm start

Try It

React App Frontend

REST API Backend

  • Invoke the transactions endpoint
curl http://localhost:5000/api/v1/transactions
  • Check the account balance
curl http://localhost:5000/api/v1/balance

Debug It

Debug the server:

npm run dev:debug

Feed some random data

# random amount credit
curl 'http://localhost:5000/api/v1/transactions' -H 'Content-Type: application/json' --data-binary "{\"type\": \"credit\", \"amount\": $RANDOM}"
# 10 bucks debit
curl 'http://localhost:5000/api/v1/transactions' -H 'Content-Type: application/json' --data-binary "{\"type\": \"debit\", \"amount\": 10}"