This is a front-end project based on Node.js and koa web framework.
-
Users can get an image for a specific dog breed thourgh reading input and calling dog API.
-
Users can get a random dog picture through calling dog API.
-
There is a test file for random dog pictures.
Inside this project, run
node main.js
If the server starts successfully, you will see
Server running on http://localhost:3011
in the terminal. At the same time, a web page will appear.
Users can search through a specific dog breed or getting a random image.
A middleware called "Jest" is used and needed here. Test file is in dogs-main_tests_ and called "routes.test.js".
npm install -D jest supertest
Package.json should have been revised. If not, please revise in the following way.
//package.json "scripts": { "test": "jest --watchAll", },
After setting an expecting status code, console will compare real status code and print a url for the random image.
Run the following command to start testing.
npm run test