Qantas Challenge
Assume the following helper objects are already defined in your environment, request
and db
with the following functions:
/*
* Performs a get request and returns a RequestReturnObject
*/
request.get(url: String): RequestReturnObject
/*
* Saves an arbitrary object in a NoSQL database
*/
db.save(obj: Object)
/*
* Find all objects whose attibute @attr matches the regular
* expression @what
*/
db.find(attr: String, what: RegExp)
-
Define a minimal set of properties available in the
RequestReturnObject
. Eg: if we had to define the minimal properties in acarObject
they could look like this:carObject: brand: String, color: String, engineSize: Int, drive: '2wd' | '4wd' | 'awd'
-
Write a script/class that given 4 urls, it will send a request to each one of them and store the result in the database.
-
Now, if a given url is in the
test.com
domain, also print the results tostdout
. Eg:http://site1.com/path
- save to db onlyhttp://site2.com/path
- save to db onlyhttp://test.com/path
- save to db and print
-
Write a function that will find all urls in the database that tried to set a cookie when requested. Eg: back to the
carsObject
example, if we had to find all cars that are notawd
we could do:function findAllNonAWDCars = { return db.find('drive',/(2|4)wd/); }
-
using Create React App build a react application and update the UI using bootstrap
-
create some json data either in a .json file, mongodb or firestore and use the apis you developed above to pull data from the database/file
-
create a view in react that now displays data
-
now write a search component that allows a user to search for records in the db/file.
-
write a higher order component that does some validation on the search page before loading the data.