Skip to content

Commit

Permalink
Merge pull request #112 from SpareCores/amplify
Browse files Browse the repository at this point in the history
support aws amplify
  • Loading branch information
daroczig authored Sep 5, 2024
2 parents b35d88f + 64a9be6 commit 2bc6de0
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2 deletions.
7 changes: 7 additions & 0 deletions amplify-manifester.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

rm -rf ./.amplify-hosting
mkdir -p ./.amplify-hosting/compute
cp -r ./dist/sc-www/server ./.amplify-hosting/compute/default
cp -r ./dist/sc-www/browser ./.amplify-hosting/static
cp deploy-manifest.json ./.amplify-hosting/deploy-manifest.json
7 changes: 7 additions & 0 deletions customHttp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
customHeaders:
- pattern: '/assets/giscus.css'
headers:
- key: 'Access-Control-Allow-Origin'
value: 'https://giscus.app'
- key: 'Access-Control-Allow-Methods'
value: 'OPTIONS,GET'
31 changes: 31 additions & 0 deletions deploy-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"version": 1,
"framework": { "name": "express", "version": "4.18.2" },
"routes": [
{
"path": "/*.*",
"target": {
"kind": "Static",
"cacheControl": "public, max-age=1, immutable"
},
"fallback": {
"kind": "Compute",
"src": "default"
}
},
{
"path": "/*",
"target": {
"kind": "Compute",
"src": "default"
}
}
],
"computeResources": [
{
"name": "default",
"runtime": "nodejs20.x",
"entrypoint": "server.mjs"
}
]
}
5 changes: 3 additions & 2 deletions server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { REQUEST, RESPONSE } from './src/express.tokens';
export function app(): express.Express {
const server = express();
const serverDistFolder = dirname(fileURLToPath(import.meta.url));
const browserDistFolder = resolve(serverDistFolder, '../browser');
//const browserDistFolder = resolve(serverDistFolder, '../browser');
const browserDistFolder = resolve(serverDistFolder, '../../static');
const indexHtml = join(serverDistFolder, 'index.server.html');

const commonEngine = new CommonEngine();
Expand Down Expand Up @@ -49,7 +50,7 @@ export function app(): express.Express {
}

function run(): void {
const port = process.env['PORT'] || 4000;
const port = process.env['PORT'] || 3000;

// Start up the Node server
const server = app();
Expand Down

0 comments on commit 2bc6de0

Please sign in to comment.