cypress-io / cypress-realworld-app

A payment application to demonstrate real-world usage of Cypress testing methods, patterns, and workflows.
https://docs.cypress.io
MIT License
5.54k stars 2.24k forks source link

Build Project for Production and Serve Project #1551

Open ukohae opened 6 months ago

ukohae commented 6 months ago

Hi, when I build the project with yarn build and serve the project serve -s build , I am unable to log in with the existing users in the DB or create a new user. What do I do?

MikeMcC399 commented 6 months ago

@ukohae

You should follow the README documentation Run the app and start the front-end and back-end with:

yarn dev
MikeMcC399 commented 6 months ago
$ yarn dev
yarn run v1.22.19
$ yarn db:seed:dev
$ yarn predev:cognito:ci
$ yarn copy:mock:awsexports && yarn copy:mock:awsexportses5
$ ncp scripts/mock-aws-exports.js src/aws-exports.js
$ ncp scripts/mock-aws-exports-es5.js aws-exports-es5.js
$ ncp ./data/database-seed.json ./data/database.json
$ cross-env NODE_ENV=development concurrently yarn:start:react yarn:start:api:watch
$ vite
$ nodemon --exec yarn tsnode --watch 'backend' backend/app.ts
[start:api:watch] [nodemon] 2.0.22
[start:api:watch] [nodemon] to restart at any time, enter `rs`
[start:api:watch] [nodemon] watching path(s): 'backend'
[start:api:watch] [nodemon] watching extensions: ts,json
[start:api:watch] [nodemon] starting `yarn tsnode backend/app.ts`
$ nyc --silent ts-node -P tsconfig.tsnode.json backend/app.ts
[start:react] 
[start:react]   VITE v4.4.2  ready in 820 ms
[start:react]
[start:react]   ➜  Local:   http://localhost:3000/
[start:react]   ➜  Network: use --host to expose
[start:api:watch] Browserslist: caniuse-lite is outdated. Please run:
[start:api:watch]   npx update-browserslist-db@latest
[start:api:watch]   Why you should do it regularly: https://github.com/browserslist/update-db#readme
[start:api:watch] express-validator: sanitize(), sanitizeBody() and other sanitization-only middlewares have been deprecated.
[start:api:watch] Please use check(), body() and others instead, which must offer the same API, and more.
[start:api:watch] Backend server running at http://localhost:3001
ukohae commented 6 months ago

@MikeMcC399

I want to deploy the artifacts and test it in the cloud.

When I run yarn build, it builds an artifacts by creating a build folder.

When I try to serve the build artifacts with serve -s build I am unable to log in.

I don’t want test to locally by running yarn dev, I want to test the content in the build artifacts

MikeMcC399 commented 6 months ago

@ukohae

You can check the examples in:

for how to run in CI.