Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix react-website example #35

Merged
merged 2 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions examples/react-website/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,35 @@ Notice that `./website` is a basic react website, the only file we changed is `/

## Dev mode

`wing run examples/react-website/main.w`
`wing run examples/react-website/wing/main.w`

The command above will open both the simulator and react dev app on the browser.

Try to make some changes to the wing file and watch the react file changes!

## Run on simulator when react is in dev mode

`wing test examples/react-website/main.w`
`wing test examples/react-website/wing/main.w`

Done developing, let's build the website, still on the simulator:

## Run on simulator when react is in build mode

1. Add `useBuildCommand: true` to line 18
2. run:
`wing run examples/react-website/main.w`
`wing run examples/react-website/wing/main.w`

## Build on tf-aws

Now, let's test it on tf-aws platform:

`wing test -t tf-aws examples/react-website/main.w`
`wing test -t tf-aws examples/react-website/wing/main.w`

Great! Everything is working, now let's deploy to AWS:

`wing compile -t tf-aws examples/react-website/main.w`
`wing compile -t tf-aws examples/react-website/wing/main.w`

then go to the `examples/react-website/target/main.tfaws` folder, and run:
then go to the `examples/react-website/wing/target/main.tfaws` folder, and run:
`terraform init`

and
Expand Down
2 changes: 1 addition & 1 deletion examples/react-website/website/public/wing.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is generated by wing
window.wingEnv = {
"REACT_APP_SERVER_URL": "http://127.0.0.1:49946",
"REACT_APP_SERVER_URL": "http://127.0.0.1:53645",
"G": "123"
};
tsuf239 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ return cloud.ApiResponse {
});

let website = new ex.ReactApp(
projectPath: "./website",
projectPath: "../website",
localPort: 3002,
);

Expand Down