This is a front-end project built with Node.js and the Koa web framework, allowing users to search for dog images by breed or retrieve random dog images.
- Search by Breed: Users can input a specific dog breed to retrieve an image corresponding to that breed.
- Random Dog Image: Users can obtain a random dog picture.
- Testing: Includes test files for random dog picture retrieval.
- Node.js installed on your machine.
- Clone the repository:
git clone https://github.com/Yiqing-Gu/Dog-Image-Search.git
- Navigate to the project directory:
cd Dog-Image-Search
- Install the dependencies:
npm install
- Start the server:
node main.js
- If the server starts successfully, the terminal will display:
Server running on http://localhost:3011
- Open your web browser and navigate to
http://localhost:3011
. - Use the interface to search for a specific dog breed or get a random dog image.
This project uses Jest and SuperTest for testing.
- Install the testing dependencies:
npm install -D jest supertest
- Ensure your
package.json
includes the following under "scripts":"scripts": { "test": "jest --watchAll" }
- To run the tests:
npm run test
- The console will display the test results, including status codes and URLs for random images.