This API Handles customers accounts creation and manipulates their information and activities.
In order to organize the code, I have created separated directories for the backend and the frontend codes.
However, you would be able to run the application from the directory root as described below.
Note: Frontend is not ready yet.
First, you need to clone the GitHub repository on our local machine and go to the application directory, afterwards.
Please run the following commands in your terminal:
$ git clone https://github.com/mahdifani14/customer-account-api.git
$ cd customer-account-api
To run the backend, in the directory root run the following commands:
$ npm i
$ npm run start:backend
To access the server Swagger web interface, go to http://localhost:8080 in your browser.
You can use the provided authentication token and customer info below to practice with the endpoints:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjE0IiwibmFtZSI6Ik1haGRpIiwidXNlcl90eXBlIjoidXNlciJ9.4__s_wv81LyO-Qq61ExHXUZIu8-OOlW0l6AObtMnsEs
Initially, only one customer exists in our DB which you can see below his info:
{
"id": "5a34f3d4-3476-4e24-90d7-faf632b58e85",
"name": "mahdi",
"surname": "fanidisfani"
}
In our database, we have three collections, customers
, accounts
, and transactions
in which we store customers, accounts and transactions information, respectively. To access the initial entities, you could go to backend/db/
directory and check JSON files. Feel free to add more users for test purposes but remember to follow the existing data structure.
The npm run start:backend
command is doing couple of things in parallel. First, it installs MongoDB Node module for DB management and run MongoDB locally then it goes to backend directory and after installing dependencies, it runs the backend server.
As you may notice, we are running both DB and server in a single terminal tab, the server and DB logs are getting mixed. If you prefer to have a more clear monitoring on both, you can open two separated terminal tabs then go to the application directory again in both terminals. After that, run the specified terminal commands below in the root of application directory, respectively:
$ npm i
$ npm run mongodb
$ npm run runBackend
Now, you can see DB and server are running in different terminals and you could clearly monitor their logs.