Skip to content

hrkbrahmbhatt/Assignement1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Assignement1

Promise Usage

Pre-requisites

Getting started

  • Clone the repository
git clone  <git lab template url> <project_name>
  • Build and run the project
node index.js

Navigate to http://localhost:3000 in POSTMAN

Task to do

  1. Node Module with a findServer() function which should return a Promise that either:

    • Resolves with the online server that has the lowest priority number.
    • Rejects with an error, if no Servers are online.
  2. HTTP GET requests should be used to determine if a server is online or offline additionally the following is required:

    • All GET requests should be done simultaneously.
    • A GET request should timeout after 5 seconds.
    • A server should be considered online if it’s response status code is between 200 and 299.
  • Server Array
 {
   "url": "http://doesNotExist.boldtech.co",
   "priority": 1
 },
 {
   "url": "http://boldtech.co",
   "priority": 7
 },
 {
   "url": "http://offline.boldtech.co",
   "priority": 2
 },
 {
   "url": "http://google.com",
   "priority": 4
 }
]

Output

Alt Text

About

Promise usage

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors