Skip to content
This repository was archived by the owner on Oct 21, 2024. It is now read-only.

Commit 9999e2a

Browse files
committed
dcos: deno
1 parent 3b37ca8 commit 9999e2a

File tree

11 files changed

+471
-1
lines changed

11 files changed

+471
-1
lines changed

examples/aws-deno/.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.sst

examples/aws-deno/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
# sst
3+
.sst

examples/aws-deno/Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM denoland/deno
2+
3+
EXPOSE 8000
4+
5+
USER deno
6+
7+
WORKDIR /app
8+
9+
ADD . /app
10+
11+
RUN deno install --entrypoint main.ts
12+
13+
CMD ["run", "--allow-all", "main.ts"]

examples/aws-deno/deno.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"tasks": {
3+
"dev": "deno run --watch --allow-all main.ts"
4+
},
5+
"imports": {
6+
"@std/assert": "jsr:@std/assert@1",
7+
"ioredis": "npm:ioredis@^5.4.1",
8+
"sst": "npm:sst@latest"
9+
}
10+
}

examples/aws-deno/deno.lock

+140
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/aws-deno/main.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Resource } from "sst";
2+
import { Cluster } from "ioredis";
3+
4+
const redis = new Cluster(
5+
[{ host: Resource.MyRedis.host, port: Resource.MyRedis.port }],
6+
{
7+
dnsLookup: (address, callback) => callback(null, address),
8+
redisOptions: {
9+
tls: {},
10+
username: Resource.MyRedis.username,
11+
password: Resource.MyRedis.password,
12+
},
13+
},
14+
);
15+
16+
Deno.serve(async (_req) => {
17+
const counter = await redis.incr("counter");
18+
return new Response(`Hit counter: ${counter}`);
19+
});

examples/aws-deno/main_test.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { assertEquals } from "@std/assert";
2+
import { add } from "./main.ts";
3+
4+
Deno.test(function addTest() {
5+
assertEquals(add(2, 3), 5);
6+
});

examples/aws-deno/sst.config.ts

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/// <reference path="./.sst/platform/config.d.ts" />
2+
3+
export default $config({
4+
app(input) {
5+
return {
6+
name: "aws-deno",
7+
removal: input?.stage === "production" ? "retain" : "remove",
8+
home: "aws",
9+
};
10+
},
11+
async run() {
12+
const vpc = new sst.aws.Vpc("MyVpc", { bastion: true });
13+
const redis = new sst.aws.Redis("MyRedis", { vpc });
14+
const cluster = new sst.aws.Cluster("MyCluster", { vpc });
15+
16+
cluster.addService("MyService", {
17+
link: [redis],
18+
public: {
19+
ports: [{ listen: "80/http", forward: "8000/http" }],
20+
},
21+
dev: {
22+
command: "deno task dev",
23+
},
24+
});
25+
},
26+
});

www/astro.config.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const sidebar = [
2121
{ label: "Nuxt", slug: "docs/start/aws/nuxt" },
2222
{ label: "Solid", slug: "docs/start/aws/solid" },
2323
{ label: "tRPC", slug: "docs/start/aws/trpc" },
24+
{ label: "Deno", slug: "docs/start/aws/deno" },
2425
{ label: "Hono", slug: "docs/start/aws/hono" },
2526
{ label: "Astro", slug: "docs/start/aws/astro" },
2627
{ label: "Email", slug: "docs/start/aws/email" },

www/src/content/docs/docs/start/aws/bun.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ We are directly accessing our Redis cluster with `Resource.MyRedis.*`.
190190

191191
Let's update the `/` route.
192192

193-
```ts title="index.tjs"
193+
```ts title="index.ts"
194194
if (url.pathname === "/" && req.method === "GET") {
195195
const counter = await redis.incr("counter");
196196
return new Response(`Hit counter: ${counter}`);

0 commit comments

Comments
 (0)