mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 16:55:37 +02:00
Merging this prematurely to make sure the team is on the same boat... like dang! We need to find a better way to do this. Plus it has become too big
47 lines
1.0 KiB
TypeScript
47 lines
1.0 KiB
TypeScript
import { vpc } from "./vpc";
|
|
import { bus } from "./bus";
|
|
import { domain } from "./dns";
|
|
import { secret } from "./secret";
|
|
import { postgres } from "./postgres";
|
|
|
|
sst.Linkable.wrap(random.RandomString, (resource) => ({
|
|
properties: {
|
|
value: resource.result,
|
|
},
|
|
}));
|
|
|
|
export const urls = new sst.Linkable("Urls", {
|
|
properties: {
|
|
api: "https://api." + domain,
|
|
auth: "https://auth." + domain,
|
|
site: $dev ? "http://localhost:3000" : "https://" + domain,
|
|
},
|
|
});
|
|
|
|
export const apiFunction = new sst.aws.Function("ApiFn", {
|
|
vpc,
|
|
handler: "packages/functions/src/api/index.handler",
|
|
link: [
|
|
bus,
|
|
urls,
|
|
postgres,
|
|
secret.PolarSecret,
|
|
],
|
|
timeout: "3 minutes",
|
|
streaming: !$dev,
|
|
url: true
|
|
})
|
|
|
|
export const api = new sst.aws.Router("Api", {
|
|
routes: {
|
|
"/*": apiFunction.url
|
|
},
|
|
domain: {
|
|
name: "api." + domain,
|
|
dns: sst.cloudflare.dns(),
|
|
},
|
|
})
|
|
|
|
export const outputs = {
|
|
api: api.url,
|
|
}; |