Skip to content

emmanueletukudo/truid-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

truid-challenge

Live Demo

Solution for tru.ID's developer experience challenge. An application to implement tru.ID's simCheck API. tru.ID-challenge tru.ID-challenge tru.ID-challenge tru.ID-challeng

Requirements

  • Nodejs v12.18.0
  • tru.ID CLI

Installation/Setup

  1. Download and install Nodejs here.

  2. 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
  1. On installation complete you will be requested to provide your Client ID and Client 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
  1. On installation complete, generate your tru.json config file by running the command below on your command prompt windows users or terminal for mac users.
tru projects:create truid-challenge
  1. Clone the truid-challenge repository by running the command below:
git clone https://github.com/emmanueletukudo/truid-challenge.git
  1. Install dependencies for the server and client: npm install && cd client && npm install && cd ..
  2. Step 6 relies on the previous step to avoid errors ensure to generate your tru.json file before you continue. Run npm run start to start the application.

Development

Running the Client & Server

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.

Testing

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

Production Usage

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.

Deployment

To prepare the application for deployment, follow the steps below:

  1. CD into the client folder and run the npm run build in the terminal for mac users and command prompt for windows users.
  2. Run npm run prod to export the application to static HTML and JavaScript, the exported files can be found in the out folder.
  3. Chose a cloud hosting server to deploy your app to, in my case Heroku.
  4. Connect your giHub to the Heroku.
  5. Publish your app. Happy Hacking.

Contributing

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.

License

MIT