Bear api
Get started
A recent version of nodejs should be installed. Then in the project root folder run via cmd or any given terminal:
npm install
and then
npm start
then open localhost:8080 and "Hello world" should be returned
Endpoints
-
/bears - returns a list of bear objects, randomly fails 10% of the time
-
/bears/1 - will return the first bear from the list, there are 4 bears in total. Also randomly fails 10% of the time. Trying to search for a non-existing bear, e.g. - /bears/7 always returns an error
-
/bears/search?name=some_search_string - returns a list of matched bears ( by their name)
Accessing from front end apps
-
Returns all bears:
fetch("http://localhost:8080/bears");
-
Returns a single bear
fetch("http://localhost:8080/bears/2");
-
Searches for a bear by name
fetch("http://localhost:8080/bears/search?name=polar}");