Node.js (Coding)

 60 Minutes
 3 Questions


This test will assess a candidate's knowledge and understanding of coding, NodeJS, and Express Service. It will include questions on topics such as the basics of coding, the syntax of NodeJS, and the features of Express Service. The test will also include practical exercises to evaluate the candidate's ability to write code and create applications using NodeJS and Express Service.


Example Question:

Coding
In this question, you are requested to create an express service for the bank.
Given the customer's name and amount of money to deposit or withdraw (by the number sign +/-) you should indicate the success or failure by the following:



If the customer balance doesn't have enough money for the withdrawal you should return -1 to signal for error, otherwise 0.



The current balances are as follows:
  1. BruceWayne -
  2. The current balance is 58$.
  3. ClarkKent -
  4. The current balance is 21$.
  5. DianaPrince -
  6. The current balance is 112$.






Your API should support the following:



Url: UpdateBalance
Method: POST
Request Body (as JSON) :
{
"customerName": ....,
"amount" : ....
}
the amount can be positive for a deposit or negative for a withdrawal.
Response: 0 for success, -1 for error.



Url: GetBalance
Method: GET
Parameters: customerName
Response: the customer balance.



*All responses must be strings (not numbers or objects)



For example:
/GetBalance?customerName=BruceWayne
Response: 58
--------
Post to /UpdateBalance:
{
"customerName": "BruceWayne",
"amount" : 5
}
Response: 0
--------
/GetBalance?customerName=BruceWayne
Response: 63
Because the balance was updated in the example above
--------
Post to /UpdateBalance:
{
"customerName": "BruceWayne",
"amount" : -500
}
Response: -1
Because the balance doesn't have enough money to withdraw 500$.