Added CORS to Express and configured localhost to be an allowed origin
Added line ending rules in ESLint and Prettier to make line endings congruent between Windows and Mac / Linux
Setup mock server with msw to hijack real requests to the API in order to create more reliable tests
Changed implementation of useFetchedPhotos to fetch photos from the backend server instead of directly from Pexels in order to encapsulate the API key in the backend code so it isn't included in the final frontend build code
Deleted duplicate frontend src folder and its contents
Test steps
In the root directory, run yarn install. I think this will work to install dependencies for each of the packages, but if it doesn't, navigate into the frontend and backend folder and run yarn install.
In packages/frontend/.env.local, add API_URL=http://localhost:8080
In .env.local in the root directory, add API_PORT=8080
Start both the frontend and backend apps
Open dev tools and verify that an array of five photos is logged in the terminal
Description of changes
localhost
to be an allowed originmsw
to hijack real requests to the API in order to create more reliable testsuseFetchedPhotos
to fetch photos from the backend server instead of directly from Pexels in order to encapsulate the API key in the backend code so it isn't included in the final frontend build codesrc
folder and its contentsTest steps
yarn install
. I think this will work to install dependencies for each of the packages, but if it doesn't, navigate into the frontend and backend folder and runyarn install
.packages/frontend/.env.local
, addAPI_URL=http://localhost:8080
.env.local
in the root directory, addAPI_PORT=8080