Skip to content

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

raksiv
Copy link
Member

@raksiv raksiv commented Apr 7, 2025

No description provided.

@raksiv raksiv self-assigned this Apr 7, 2025
Copy link

vercel bot commented Apr 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nitric-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 10, 2025 5:52pm

Copy link
Member

@tjholm tjholm left a 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')
Copy link
Member

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:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<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>

Comment on lines +214 to +216
## 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 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
```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants