Solution for tru.ID's developer experience challenge. An application to implement tru.ID's simCheck API.
- Nodejs v12.18.0
- tru.ID CLI
-
Download and install Nodejs here.
-
Install tru.ID's
CLI
by running the command below on your terminal
npm install -g https://cli.tru.id/tru-v0.5.0/tru-v0.5.0-darwin-x64.tar.gz
- On installation complete you will be requested to provide your
Client ID
andClient Secret
. You can obtain both from your tru.ID's console. Visit to tru.id to register.
Client ID
your-truid-client-ID
Client Secret
your-truid-client-secret
- On installation complete, generate your
tru.json
config file by running the command below on your command promptwindows
users or terminal formac
users.
tru projects:create truid-challenge
- Clone the
truid-challenge
repository by running the command below:
git clone https://github.com/emmanueletukudo/truid-challenge.git
- Install dependencies for the server and client:
npm install && cd client && npm install && cd ..
- Step 6 relies on the previous step to avoid errors ensure to generate your
tru.json
file before you continue. Runnpm run start
to start the application.
For development build run the command below:
npm run dev
[nodemon] to restart at any time, enter `rs`
[0] [nodemon] watching path(s): *.*
[0] [nodemon] watching extensions: js,mjs,json
[0] [nodemon] starting `node src/index.js`
Applocation is listening at 5000
[1] Browserslist: caniuse-lite is outdated. Please run:
[1] npx browserslist@latest --update-db
[1] ready - started server on http://localhost:3000
[1] event - compiled successfully
You can hold the command and click on the http://localhost:3000
to launch the application. You should have a web page similar to the screenshots above. Note: All commands assumes you are in the application's root folder.
The test files for the frontend can be found in test
folder in the client directory. Similarly, the test files for endpoints can be found in test
folder in the root directory of the application.
To run the test for the backend run the command below:
npm run test
To view the production build run the command below:
npm start
Response:
> node src/index.js
Application is listening at 5000
Visit http://localhost:5000
on your preferred browser to view the application.
To prepare the application for deployment, follow the steps below:
CD
into the client folder and run thenpm run build
in the terminal formac
users and command prompt forwindows
users.- Run
npm run prod
to export the application to static HTML and JavaScript, the exported files can be found in the out folder. - Chose a cloud hosting server to deploy your app to, in my case
Heroku
. - Connect your
giHub
to theHeroku
. - Publish your app. Happy Hacking.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.