-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
185 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import Server from "@app/mod.ts"; | ||
import markdown from "@app/middleware/markdown/mod.tsx"; | ||
import blogLayout from "@app/modules/blog/blog.layout.tsx"; | ||
import docsLayout from "@app/modules/docs/docs.layout.tsx"; | ||
import blog from "@app/modules/blog/mod.ts"; | ||
import docs from "@app/modules/docs/mod.ts"; | ||
import index from "@app/modules/index/mod.ts"; | ||
import { tailwind } from "@app/middleware/tailwind/mod.ts"; | ||
import { authModule } from "@app/auth/mod.tsx"; | ||
import { adminModule } from "@app/modules/admin/mod.ts"; | ||
|
||
const s = new Server(); | ||
|
||
/** markdown with default folder and prefix */ | ||
s.use(markdown(blogLayout)); | ||
|
||
/** markdown with 'docs' folder and prefix */ | ||
s.use(markdown(docsLayout, "docs", "docs")); | ||
|
||
/** setup tailwind */ | ||
s.use(tailwind()); | ||
|
||
/** proxy for github repo */ | ||
s.use(async (_req, ctx) => { | ||
if ( | ||
ctx.url.pathname.endsWith(".ts") || | ||
ctx.url.pathname.endsWith(".tsx") | ||
) { | ||
const version = ctx.url.pathname.startsWith("/v") | ||
? "" | ||
: ctx.url.pathname.startsWith("/canary") | ||
? "/canary" | ||
: "/main"; | ||
|
||
const path = | ||
`https://raw.githubusercontent.com/fastrodev/fastro${version}${ctx.url.pathname}`; | ||
const res = await fetch(path); | ||
const content = await res.text(); | ||
return new Response(content); | ||
} | ||
return ctx.next(); | ||
}); | ||
|
||
s.group(index); | ||
s.group(blog); | ||
s.group(docs); | ||
s.group(authModule); | ||
s.group(adminModule); | ||
|
||
s.serve(); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Fastro } from "@app/mod.ts"; | ||
import tocLayout from "@app/modules/toc/toc.layout.tsx"; | ||
import tocApp from "../toc/toc.page.tsx"; | ||
|
||
export default function (s: Fastro) { | ||
s.page("/blog", { | ||
component: tocApp, | ||
layout: tocLayout, | ||
folder: "modules/toc", | ||
handler: (_req, ctx) => { | ||
return ctx.render({ | ||
title: "Blog", | ||
description: "Blog", | ||
destination: "/blog", | ||
posts: [ | ||
{ | ||
title: "Collaboration and Profit Sharing", | ||
url: "/blog/collaboration", | ||
date: "06/18/2024", | ||
}, | ||
{ | ||
title: "Set up Tailwind on Deno", | ||
url: "/blog/tailwind", | ||
date: "01/26/2024", | ||
}, | ||
{ | ||
title: "Deno KV OAuth Implementation", | ||
url: "/blog/oauth", | ||
date: "11/15/2023", | ||
}, | ||
{ | ||
title: "renderToReadableStream", | ||
url: "/blog/render_to_readable_stream", | ||
date: "10/26/2023", | ||
}, | ||
{ | ||
title: "React", | ||
url: "/blog/react", | ||
date: "10/22/2023", | ||
}, | ||
{ | ||
title: "Preact", | ||
url: "/blog/preact_and_encrypted_props", | ||
date: "08/16/2023", | ||
}, | ||
{ | ||
title: "Hello", | ||
url: "/blog/hello", | ||
date: "11/15/2023", | ||
}, | ||
], | ||
}); | ||
}, | ||
}); | ||
|
||
return s; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Fastro } from "@app/mod.ts"; | ||
import tocLayout from "@app/modules/toc/toc.layout.tsx"; | ||
import tocApp from "../toc/toc.page.tsx"; | ||
import { docToc } from "../docs/docs.layout.tsx"; | ||
|
||
export default function (s: Fastro) { | ||
s.page("/docs", { | ||
component: tocApp, | ||
layout: tocLayout, | ||
folder: "modules/toc", | ||
handler: (_req, ctx) => { | ||
return ctx.render({ | ||
title: "Docs", | ||
description: "Docs", | ||
destination: "/docs", | ||
posts: docToc, | ||
}); | ||
}, | ||
}); | ||
|
||
return s; | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Fastro, HttpRequest } from "@app/mod.ts"; | ||
import indexApp from "../index/index.page.tsx"; | ||
import { index } from "../index/index.layout.tsx"; | ||
|
||
function init() { | ||
const basePath = Deno.env.get("DENO_DEPLOYMENT_ID") | ||
? `https://raw.githubusercontent.com/fastrodev/fastro/main/static` | ||
: "http://localhost:8000/static"; | ||
const code = | ||
`import init from "${basePath}/init.ts"; const name = Deno.args[0] ?? 'project'; await init(name);`; | ||
return new Response(code, { | ||
headers: { | ||
"content-type": "application/typescript; charset=utf-8", | ||
}, | ||
}); | ||
} | ||
|
||
function denoRunCheck(req: HttpRequest) { | ||
const regex = /^Deno\/(\d+\.\d+\.\d+)$/; | ||
const string = req.headers.get("user-agent"); | ||
if (!string) return false; | ||
const match = regex.exec(string); | ||
if (!match) return false; | ||
return true; | ||
} | ||
|
||
export default function (s: Fastro) { | ||
/** setup SSR */ | ||
s.page("/", { | ||
component: indexApp, | ||
layout: index, | ||
folder: "modules/index", | ||
handler: (req, ctx) => { | ||
const res = denoRunCheck(req); | ||
if (res) return init(); | ||
return ctx.render({ | ||
title: "Fast & Modular Web Framework", | ||
description: | ||
"Build SSR web applications with a flat modular architecture", | ||
image: "https://fastro.dev/fastro.png", | ||
start: Deno.env.get("ENV") === "DEVELOPMENT" | ||
? "http://localhost:8000/docs/start" | ||
: "https://fastro.dev/docs/start", | ||
baseUrl: Deno.env.get("ENV") === "DEVELOPMENT" | ||
? "http://localhost:8000" | ||
: "https://fastro.dev", | ||
new: "Collaboration and Profit Sharing", | ||
destination: "blog/collaboration", | ||
}); | ||
}, | ||
}); | ||
return s; | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ import { type Config } from "npm:[email protected]"; | |
export default { | ||
content: [ | ||
"./components/**/*.tsx", | ||
"./web/**/**/*.tsx", | ||
"./modules/**/**/*.tsx", | ||
"./middleware/**/**/*.tsx", | ||
], | ||
theme: { | ||
|
@@ -27,41 +27,5 @@ export default { | |
}, | ||
}, | ||
}, | ||
fontFamily: { | ||
"body": [ | ||
"Inter", | ||
"ui-sans-serif", | ||
"system-ui", | ||
"-apple-system", | ||
"system-ui", | ||
"Segoe UI", | ||
"Roboto", | ||
"Helvetica Neue", | ||
"Arial", | ||
"Noto Sans", | ||
"sans-serif", | ||
"Apple Color Emoji", | ||
"Segoe UI Emoji", | ||
"Segoe UI Symbol", | ||
"Noto Color Emoji", | ||
], | ||
"sans": [ | ||
"Inter", | ||
"ui-sans-serif", | ||
"system-ui", | ||
"-apple-system", | ||
"system-ui", | ||
"Segoe UI", | ||
"Roboto", | ||
"Helvetica Neue", | ||
"Arial", | ||
"Noto Sans", | ||
"sans-serif", | ||
"Apple Color Emoji", | ||
"Segoe UI Emoji", | ||
"Segoe UI Symbol", | ||
"Noto Color Emoji", | ||
], | ||
}, | ||
}, | ||
} satisfies Config; |
Oops, something went wrong.