diff --git a/examples/aws-nuxt/app.vue b/examples/aws-nuxt/app.vue index a495b7573..5947ef77d 100644 --- a/examples/aws-nuxt/app.vue +++ b/examples/aws-nuxt/app.vue @@ -1,5 +1,24 @@ + diff --git a/examples/aws-nuxt/nuxt.config.ts b/examples/aws-nuxt/nuxt.config.ts index 88d718947..f4c5faca3 100644 --- a/examples/aws-nuxt/nuxt.config.ts +++ b/examples/aws-nuxt/nuxt.config.ts @@ -1,7 +1,8 @@ // https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ - devtools: { enabled: true }, + compatibilityDate: '2024-04-03', nitro: { - preset: "aws-lambda", + preset: 'aws-lambda' }, -}); + devtools: { enabled: true } +}) diff --git a/examples/aws-nuxt/package.json b/examples/aws-nuxt/package.json index eca89a319..334556fd0 100644 --- a/examples/aws-nuxt/package.json +++ b/examples/aws-nuxt/package.json @@ -4,18 +4,17 @@ "type": "module", "scripts": { "build": "nuxt build", - "dev": "sst dev nuxt dev", + "dev": "nuxt dev", "generate": "nuxt generate", "postinstall": "nuxt prepare", "preview": "nuxt preview" }, "dependencies": { - "nuxt": "^3.11.2", + "@aws-sdk/client-s3": "^3.651.1", + "@aws-sdk/s3-request-presigner": "^3.651.1", + "nuxt": "^3.13.0", "sst": "latest", - "vue": "^3.4.21", - "vue-router": "^4.3.0" - }, - "overrides": { - "nitropack": "npm:nitropack-nightly" + "vue": "latest", + "vue-router": "latest" } } diff --git a/examples/aws-nuxt/public/robots.txt b/examples/aws-nuxt/public/robots.txt new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/examples/aws-nuxt/public/robots.txt @@ -0,0 +1 @@ + diff --git a/examples/aws-nuxt/server/api/presigned.ts b/examples/aws-nuxt/server/api/presigned.ts new file mode 100644 index 000000000..b8c29a2e5 --- /dev/null +++ b/examples/aws-nuxt/server/api/presigned.ts @@ -0,0 +1,12 @@ +import { Resource } from "sst"; +import { getSignedUrl } from "@aws-sdk/s3-request-presigner"; +import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3"; + +export default defineEventHandler(async () => { + const command = new PutObjectCommand({ + Key: crypto.randomUUID(), + Bucket: Resource.MyBucket.name, + }); + + return await getSignedUrl(new S3Client({}), command); +}) diff --git a/examples/aws-nuxt/sst-env.d.ts b/examples/aws-nuxt/sst-env.d.ts new file mode 100644 index 000000000..261477050 --- /dev/null +++ b/examples/aws-nuxt/sst-env.d.ts @@ -0,0 +1,17 @@ +/* This file is auto-generated by SST. Do not edit. */ +/* tslint:disable */ +/* eslint-disable */ +import "sst" +export {} +declare module "sst" { + export interface Resource { + "MyBucket": { + "name": string + "type": "sst.aws.Bucket" + } + "MyWeb": { + "type": "sst.aws.Nuxt" + "url": string + } + } +} diff --git a/examples/aws-nuxt/sst.config.ts b/examples/aws-nuxt/sst.config.ts index 3f5d7bf84..1cf92a5e5 100644 --- a/examples/aws-nuxt/sst.config.ts +++ b/examples/aws-nuxt/sst.config.ts @@ -9,6 +9,11 @@ export default $config({ }; }, async run() { - new sst.aws.Nuxt("MyWeb"); + const bucket = new sst.aws.Bucket("MyBucket", { + public: true + }); + new sst.aws.Nuxt("MyWeb", { + link: [bucket], + }); }, });