Skip to content

Commit

Permalink
Add links to GitHub for related examples (#1384)
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-johansson authored Sep 11, 2024
1 parent d761717 commit b73958a
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/how-to/express-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ When using Encore.ts you get a lot of built-in features without having to instal

Below we've outlined two main strategies you can use to migrate your existing Express.js application to Encore.ts. Pick the strategy that best suits your situation and application.

<GitHubLink
href="https://github.com/encoredev/examples/tree/main/ts/expressjs-migration"
desc="Code examples for migrating an Express.js app to Encore.ts"
/>

<Accordion>

### Forklift migration (quick start)
Expand Down
5 changes: 4 additions & 1 deletion docs/how-to/vercel.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ title: Use Vercel for frontend hosting
Encore is not opinionated about where you host your frontend, pick the platform that suits your situation best. In this
guide, we'll show you how to use Vercel to host your frontend and Encore to host your backend.

Take a look at our **Encore + Next.js starter** for an example: https://github.com/encoredev/nextjs-starter
<GitHubLink
href="https://github.com/encoredev/nextjs-starter"
desc="Next.js + Encore TS Web App Starter"
/>

## Folder structure
If you want to go for a monorepo approach, you can place your frontend and backend in separate top-level folders, like so:
Expand Down
5 changes: 5 additions & 0 deletions docs/ts/concepts/hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ interface Response {

To run it, you simply use `encore run` and the Open Source CLI will automatically set up your local infrastructure.

<GitHubLink
href="https://github.com/encoredev/examples/tree/main/ts/hello-world"
desc="Hello World REST API Starter."
/>

## Getting started video

Get to know the basics of Encore.ts in this getting started video.
Expand Down
5 changes: 5 additions & 0 deletions docs/ts/develop/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ and then use `encore test` from the CLI.
The `encore test` command sets up all the necessary infrastructure in test mode before handing over to
the test runner.

<GitHubLink
href="https://github.com/encoredev/examples/tree/main/ts/uptime"
desc="Uptime monitoring app with API endpoint unit tests written in Vitest."
/>

## Test Runners

We recommend using [Vitest](https://vitest.dev) as the test runner. It's very fast, has native support for
Expand Down
5 changes: 5 additions & 0 deletions docs/ts/primitives/cron-jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ When you need to run periodic and recurring tasks, Encore's Backend Framework pr
When a Cron Job is defined, Encore will call the API of your choice on the schedule you have defined.
This means there is no need to maintain any infrastructure, as Encore handles the scheduling, monitoring and execution of Cron Jobs.

<GitHubLink
href="https://github.com/encoredev/examples/tree/main/ts/uptime"
desc="Uptime Monitoring app that uses a Cron Job to periodically check the uptime of a website."
/>

## Defining a Cron Job

To define a Cron Job, import `encore.dev/cron` and call `new CronJob`, assigning the result to a top-level variable.
Expand Down
5 changes: 5 additions & 0 deletions docs/ts/primitives/databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ lang: ts

Encore treats SQL databases as logical resources and natively supports **PostgreSQL** databases.

<GitHubLink
href="https://github.com/encoredev/examples/tree/main/ts/url-shortener"
desc="URL Shortener example that uses a PostgreSQL database."
/>

## Creating a database

To create a database, import `encore.dev/storage/sqldb` and call `new SQLDatabase`, assigning the result to a top-level variable.
Expand Down
5 changes: 5 additions & 0 deletions docs/ts/primitives/pubsub.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Publishers & Subscribers (Pub/Sub) let you build systems that communicate by bro

Encore's Backend Framework lets you use Pub/Sub in a cloud-agnostic declarative fashion. At deployment, Encore automatically [provisions the required infrastructure](/docs/deploy/infra).

<GitHubLink
href="https://github.com/encoredev/examples/tree/main/ts/simple-event-driven"
desc="Simple starter (three services) with an event-driven architecture."
/>

## Creating a Topic

The core of Pub/Sub is the **Topic**, a named channel on which you publish events.
Expand Down
5 changes: 5 additions & 0 deletions docs/ts/primitives/raw-endpoints.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ It can be called like so:
$ curl http://localhost:4000/raw
Hello, raw world!
```

<GitHubLink
href="https://github.com/encoredev/examples/tree/main/ts/slack-bot"
desc="Slack Bot app that uses Raw endpoints to accept webhooks"
/>
5 changes: 5 additions & 0 deletions docs/ts/primitives/secrets.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ Of course, we can’t do that &ndash; it's horrifyingly insecure!

Encore's built-in secrets manager makes it simple to store secrets in a secure way and lets you use them in your program like regular variables.

<GitHubLink
href="https://github.com/encoredev/examples/tree/main/ts/simple-event-driven"
desc="Simple event driven example that uses secrets to store an API key"
/>

## Using secrets in your application

To use a secret in your application, define a top-level variable directly in your code by calling the `secret` function from `encore.dev/config`.
Expand Down
6 changes: 6 additions & 0 deletions docs/ts/primitives/static-assets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Encore.ts has built-in support for serving static assets (such as images, HTML a
This is particularly useful when you want to serve a static website or a single-page application (SPA) that has
been pre-compiled into static files.

<GitHubLink
href="https://github.com/encoredev/examples/tree/main/ts/static-files"
desc="Example of how to use api.static in to serve static files."
/>


## API Reference

Serving static files in Encore.ts works similarly to regular API endpoints, but using the `api.static` function instead.
Expand Down

0 comments on commit b73958a

Please sign in to comment.