From: Roberto Morado Date: Wed, 14 Aug 2024 04:50:41 +0000 (-0400) Subject: Christ is Lord X-Git-Url: https://git.morado.dev/favicon.ico?a=commitdiff_plain;ds=sidebyside;p=morado.dev Christ is Lord --- dd98cff057a99c0e00420d45c310a497f87a920e diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3323b34 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.env +.DS_Store diff --git a/main.ts b/main.ts new file mode 100644 index 0000000..52dfbc7 --- /dev/null +++ b/main.ts @@ -0,0 +1,59 @@ +/** DEPENDENCIES */ +import "jsr:@std/dotenv/load"; +import app from "./router.ts"; + +/** CONSTANTS */ +const port = parseInt(Deno.env.get("PORT") ?? "8000"); +const publicDir = "./public"; + +/** UTILS */ +function getContentType(filename: string): string { + const ext = filename.split(".").pop(); + switch (ext) { + case "html": + return "text/html"; + case "css": + return "text/css"; + case "js": + return "text/javascript"; + case "json": + return "application/json"; + case "png": + return "image/png"; + case "jpeg": + return "image/jpeg"; + case "gif": + return "image/gif"; + case "svg": + return "image/svg+xml"; + case "ico": + return "image/x-icon"; + default: + return "application/octet-stream"; + } +} +async function serveStaticFile(filename: string): Promise { + try { + const filePath = `${publicDir}/${filename}`; + const file = await Deno.readFile(filePath); + const contentType = getContentType(filename); + return new Response(file, { + headers: { "Content-Type": contentType }, + }); + } catch (_err) { + return new Response("Not found", { status: 404 }); + } +} + +/** LOGIC */ +for await (const file of Deno.readDir(publicDir)) { + app.get(`/${file.name}`, async () => { + return await serveStaticFile(file.name); + }); +} +app.get("/", async () => { + return await serveStaticFile("index.html"); +}); + +/** SERVICE */ +Deno.serve({ port }, (req, info) => app.handler(req, info)); diff --git a/public/christ.png b/public/christ.png new file mode 100644 index 0000000..0025c83 Binary files /dev/null and b/public/christ.png differ diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..2b2df70 Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/index.css b/public/index.css new file mode 100644 index 0000000..9c18ce1 --- /dev/null +++ b/public/index.css @@ -0,0 +1,58 @@ +* { + margin: 0; + padding: 0; + font-family: Helvetica, sans-serif; + transition: all ease-in-out 0.2s; +} +body { + background-color: whitesmoke; + width: 50%; + margin: 20px auto; + display: flex; + flex-direction: column; + gap: 30px; +} +body h1, h2 { + margin-bottom: 5px; +} +body header { + display: flex; + align-items: center; + gap: 20px; +} +body header img { + width: 30%; + height: auto; + object-fit: contain; +} +body nav { + text-align: center; + padding: 15px 0; + border-top: 1px solid black; + border-bottom: 1px solid black; +} +body blockquote { + margin: 10px 5px 30px; + padding-left: 10px; + border-left: 2px solid black; +} + +/* Medium */ +@media (max-width: 768px) { + body { + width: 75%; + } +} + +/* Small */ +@media (max-width: 480px) { + body { + width: 95%; + } + body header { + flex-direction: column; + } + body header img { + width: 50%; + } +} diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..5b28d3f --- /dev/null +++ b/public/index.html @@ -0,0 +1,90 @@ + + + + + + + + Roberto Morado + + +
+ Jesus Christ Representation +
+

JESUS CHRIST IS LORD

+

The Alpha and the Omega.

+

The Lamb who was slain.

+

The King who reigns forever.

+
+ “For from Him and through Him and to Him are all things. To + Him be the glory forever. Amen.” —Romans 11:36 +
+
+
+ +
+

THE TESTIMONY OF GOD

+

God is holy.

+

Man is sinful.

+

The soul that sins will die.

+

But God, being rich in mercy, sent His Son.

+

+ Jesus Christ, the Righteous One, bore our sins in His body on + the cross. +

+

He was pierced for our transgressions.

+

+ He died, was buried, and rose again on the third day, just as + the Scriptures said. +

+

+ He is seated at the right hand of the Father—reigning until all + His enemies are under His feet. +

+
+ “This is the witness: that God gave us eternal life, and this + life is in His Son.” —1 John 5:11 +
+ +

THE CALL OF GOD

+ +

Repent, for the kingdom of heaven is at hand.

+

Believe in the Lord Jesus Christ and you will be saved.

+

+ For there is no other name under heaven given among men by which + we must be saved. +

+ +

Everyone who calls on the name of the Lord will be saved.

+

+ Everyone who does not obey the Son will not see life, but the + wrath of God remains on him. +

+ +
+ “I am the way, and the truth, and the life; no one comes to the + Father but through Me.” —John 14:6 +
+ +

THE GLORY OF GOD

+ +

+ To Him who loves us and released us from our sins by His blood— + to Him be the glory, the dominion, and the praise forever. +

+ +

Let every knee bow.

+

Let every tongue confess.

+

Let every breath give praise.

+ +

Christ is all.

+ +
+ “Worthy is the Lamb who was slain—to receive power and riches + and wisdom and might and honor and glory and blessing.” + —Revelation 5:12 +
+
+ + + diff --git a/router.ts b/router.ts new file mode 100644 index 0000000..10f75f4 --- /dev/null +++ b/router.ts @@ -0,0 +1,49 @@ +class Router { + private routes: Map> = new Map(); + + private register( + method: string, + pathname: string, + handler: Deno.ServeHandler, + ): void { + if (!this.routes.has(method)) { + this.routes.set(method, new Map()); + } + this.routes.get(method)!.set(pathname, handler); + } + private match( + method: string, + url: URL, + ): { handler: Deno.ServeHandler | null } { + const handlers = this.routes.get(method) || new Map(); + for (const [pathname, handler] of handlers) { + const uri = new URLPattern({ pathname }); + const match = uri.exec(url); + if (match) { + return { handler }; + } + } + + return { handler: null }; + } + get(pathname: string, handler: Deno.ServeHandler) { + this.register("GET", pathname, handler); + } + post(pathname: string, handler: Deno.ServeHandler) { + this.register("POST", pathname, handler); + } + handler( + req: Request, + info: Deno.ServeHandlerInfo, + ): Response | Promise { + const { handler } = this.match(req.method, new URL(req.url)); + + if (!handler) { + return new Response("Not found", { status: 404 }); + } + + return handler(req, info); + } +} + +export default new Router();