npm install
npm start
then do a post request to url:
http://localhost:3030/servers/available
https://vast-ocean-57397.herokuapp.com/servers/available
https://www.npmjs.com/package/find-available-server
- that will return the lowest priority valid url
[
{
"url": "http://doesNotExist.bosta.co",
"priority": 1
},
{
"url": "https://httpstat.us/403",
"priority": 1
},
{
"url": "http://bosta.co",
"priority": 7
},
{
"url": "http://offline.bosta.co",
"priority": 2
},
{
"url": "http://google.com",
"priority": 4
}
]
- that will return that there is no valid server
[
{
"url": "https://httpstat.us/401",
"priority": 1
},
{
"url": "https://httpstat.us/402",
"priority": 1
},
{
"url": "https://httpstat.us/403",
"priority": 7
},
{
"url": "https://httpstat.us/404",
"priority": 2
}
]```