Signed-off-by: Sam Therapy <sam@samtherapy.net>
This commit is contained in:
parent
e72f03da76
commit
63925530b1
3 changed files with 11 additions and 11 deletions
|
@ -25,9 +25,9 @@ steps:
|
|||
from_secret: DENO_DEPLOY_TOKEN
|
||||
settings:
|
||||
project: samme-blog
|
||||
entrypoint: serve.ts
|
||||
entrypoint: server.ts
|
||||
production: true
|
||||
include: dist,serve.ts
|
||||
include: dist,server.ts
|
||||
depends_on:
|
||||
- "Build site"
|
||||
when:
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import { Application, Router } from "https://deno.land/x/oak@v11.1.0/mod.ts";
|
||||
import { Application, httpErrors, Router } from "https://deno.land/x/oak@v11.1.0/mod.ts";
|
||||
|
||||
const app = new Application();
|
||||
|
||||
// First we try to serve static files from the dist folder. If that fails, we
|
||||
// fall through to the router below.
|
||||
app.use(async (ctx, next) => {
|
||||
try {
|
||||
await ctx.send({
|
||||
root: `${Deno.cwd()}/dist`,
|
||||
index: "index.html",
|
||||
});
|
||||
} catch {
|
||||
await ctx.send({
|
||||
root: `${Deno.cwd()}/dist`,
|
||||
index: "index.html",
|
||||
}).catch(async () => {
|
||||
ctx.response.status = 404
|
||||
ctx.response.body = await Deno.readTextFile(`${Deno.cwd()}/dist/404.html`);
|
||||
next();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const router = new Router();
|
|
@ -4,7 +4,7 @@ layout: layouts/base.tsx
|
|||
url: /404.html
|
||||
---
|
||||
|
||||
# You've found a dead end!
|
||||
# Well, how did I get here?
|
||||
|
||||
Would you like to [return](/)?
|
||||
|
||||
|
|
Loading…
Reference in a new issue