-
-
Notifications
You must be signed in to change notification settings - Fork 15
docs: Add typescript survey guide #732
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
0fa70b9
to
01bff0f
Compare
61aa8ac
to
3e289a7
Compare
Co-authored-by: Jye Cusch <[email protected]>
03c3b88
to
c1aa08c
Compare
c1aa08c
to
c0ba2ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, actually managed to get Cursor to complete this guide in just 3 prompts.
import { api } from '@nitric/sdk' | ||
import { output } from '../resources/resources' | ||
|
||
const receiptApi = api('receipts') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming this isn't put in resources/resources
because it's not shared.
``` | ||
|
||
Next, configure your `nitric.yaml` to enable and configure the website: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<Note> | |
Along with the website configuration, you will need to add the `preview` key to your `nitric.yaml`, as website support is currently a preview feature and subject to change. | |
</Note> | |
## Conclusion | ||
|
||
Serving your React frontend and Nitric backend under the same origin, both locally and in the cloud, eliminates CORS issues and removes the need for headers, complex gateway config, or workarounds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Conclusion | |
Serving your React frontend and Nitric backend under the same origin, both locally and in the cloud, eliminates CORS issues and removes the need for headers, complex gateway config, or workarounds. | |
## Deploying to AWS | |
With the frontend tested, you can deploy it to the cloud knowing it will function as intended. Nitric will deploy your frontend and backend together, serving them under the same origin. This eliminates CORS issues and removes the need for headers, complex gateway config, or workarounds. | |
Deployment to the cloud requires that you have created a stack file. If you had followed the backend guide, you should have this stack file already; otherwise, follow the steps below. | |
### Create your stack | |
Create an AWS stack called `aws-staging` for your staging environment. | |
```bash | |
nitric stack new aws-staging aws | |
``` | |
Inside the stack file, set your `region`. | |
```yaml title:nitric.dev.yaml | |
provider: nitric/aws@latest | |
region: us-east-2 | |
``` | |
## Deploy | |
Deploy to AWS using the `nitric up` command. Ensure you have set up your [AWS credentials](/providers/pulumi/aws#usage) correctly. | |
```bash | |
nitric up | |
``` | |
This should output a URL pointing to the CDN like `xxxx.cloudfront.net`. You can go to this URL in your browser, and it will take you to the website with your survey form. All API routes will be served under `xxxx.cloudfront.net/apis`. | |
## Tear down | |
To avoid unwanted costs of running your test app, you can tear down the stack using the `nitric down` command. | |
```bash | |
nitric down | |
``` |
No description provided.