Skip to content

Commit 30b70ee

Browse files
Update ts examples (#179)
1 parent 9db4569 commit 30b70ee

File tree

34 files changed

+6922
-2852
lines changed

34 files changed

+6922
-2852
lines changed

ts/auth0-react-sdk/README.md

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Next, go to the *Application Settings* section. There you will find the `Domain`
3030
Copy these values, we will need them shortly.
3131

3232
A callback URL is where Auth0 redirects the user after they have been authenticated. Add `http://localhost:3000` to the *Allowed Callback URLs*.
33-
You will need to add more URLs to this list when you have a production or staging environments.
33+
You will need to add more URLs to this list when you have a deployed frontend environment.
3434

3535
The same goes for the logout URL (were the user will get redirected after logout). Add `http://localhost:3000` to the *Allowed Logout URLs*.
3636

@@ -82,27 +82,54 @@ Keep the contract between the backend and frontend in sync by regenerating the r
8282
to an Encore endpoint.
8383

8484
```bash
85-
npm run gen # Deployed Encore staging environment
86-
# or
87-
npm run gen:local # Locally running Encore backend
85+
npm run gen # Locally running Encore backend
8886
```
8987

9088
## Deployment
9189

92-
### Encore
90+
### Encore Backend
9391

94-
Deploy your backend to a staging environment in Encore's free development cloud:
92+
#### Self-hosting
93+
94+
See the [self-hosting instructions](https://encore.dev/docs/self-host/docker-build) for how to use `encore build docker` to create a Docker image and configure it.
95+
96+
#### Encore Cloud Platform
97+
98+
Deploy your application to a free staging environment in Encore's development cloud using `git push encore`:
9599

96100
```bash
97101
git add -A .
98102
git commit -m 'Commit message'
99103
git push encore
100104
```
101105

102-
Then head over to the [Cloud Dashboard](https://app.encore.dev) to monitor your deployment and find your production URL.
106+
You can also open your app in the [Cloud Dashboard](https://app.encore.dev) to integrate with GitHub, or connect your AWS/GCP account, enabling Encore to automatically handle cloud deployments for you.
107+
108+
#### Link to GitHub
109+
110+
Follow these steps to link your app to GitHub:
111+
112+
1. Create a GitHub repo, commit and push the app.
113+
2. Open your app in the [Cloud Dashboard](https://app.encore.dev).
114+
3. Go to **Settings ➔ GitHub** and click on **Link app to GitHub** to link your app to GitHub and select the repo you just created.
115+
4. To configure Encore to automatically trigger deploys when you push to a specific branch name, go to the **Overview** page for your intended environment. Click on **Settings** and then in the section **Branch Push** configure the **Branch name** and hit **Save**.
116+
5. Commit and push a change to GitHub to trigger a deploy.
117+
118+
[Learn more in the docs](https://encore.dev/docs/how-to/github)
119+
120+
### React frontend
121+
122+
#### Vercel
123+
124+
The frontend can be deployed to Vercel. Follow these steps:
125+
126+
1. Create a repo and push the project to GitHub.
127+
2. Create a new project on Vercel and point it to your GitHup repo.
128+
3. Select `frontend` as the root directory for the Vercel project.
103129

104-
From there you can also see metrics, traces, connect your app to a
105-
GitHub repo to get automatic deploys on new commits, and connect your own AWS or GCP account to use for deployment.
130+
Once you have your frontend deployed:
131+
* Update the *Allowed Callback URLs*, *Allowed Logout URLs* & *Allowed Web Origins* settings in your application on Auth0 with the deployed Vercel URL.
132+
* Set the `allow_origins_with_credentials` in the `encore.app` (see below) file to the deployed Vercel URL.
106133

107134
## CORS configuration
108135

ts/auth0-react-sdk/encore.app

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
{
2-
"id": "",
3-
"lang": "typescript"
2+
"id": "",
3+
"lang": "typescript",
4+
"global_cors": {
5+
"allow_origins_with_credentials": [
6+
"<FRONTEND-ORIGIN-GOES-HERE>"
7+
],
8+
}
49
}

ts/auth0-react-sdk/frontend/encore.service.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)