From 09b7fad76e6faf0de979cf81f15d3354580cf1df Mon Sep 17 00:00:00 2001 From: moebiusmania Date: Sat, 16 Nov 2024 15:01:24 +0100 Subject: [PATCH] feat: adding another endpoint --- README.md | 2 +- components/Hero.tsx | 4 ++-- fresh.gen.ts | 2 ++ routes/_app.tsx | 2 +- routes/api/mit-license.ts | 27 +++++++++++++++++++++++++++ routes/index.tsx | 5 +++++ 6 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 routes/api/mit-license.ts diff --git a/README.md b/README.md index 6acf395..5ccd7ca 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # sl-utils -> A small collection of utilities for myself 🤓 +> 🛠️ A small collection of utilities for myself 🤓 https://sl-utils.deno.dev/ diff --git a/components/Hero.tsx b/components/Hero.tsx index 16f6661..19ac36b 100644 --- a/components/Hero.tsx +++ b/components/Hero.tsx @@ -4,7 +4,7 @@ export const Hero = () => {
@@ -12,7 +12,7 @@ export const Hero = () => { sl-utils

- A small collection of utilities for myself 🤓 + 🛠️ A small collection of utilities for myself 🤓

); diff --git a/fresh.gen.ts b/fresh.gen.ts index 95efca2..6fa03a3 100644 --- a/fresh.gen.ts +++ b/fresh.gen.ts @@ -4,6 +4,7 @@ import * as $_404 from "./routes/_404.tsx"; import * as $_app from "./routes/_app.tsx"; +import * as $api_mit_license from "./routes/api/mit-license.ts"; import * as $api_password from "./routes/api/password.ts"; import * as $api_qr_code from "./routes/api/qr-code.ts"; import * as $greet_name_ from "./routes/greet/[name].tsx"; @@ -15,6 +16,7 @@ const manifest = { routes: { "./routes/_404.tsx": $_404, "./routes/_app.tsx": $_app, + "./routes/api/mit-license.ts": $api_mit_license, "./routes/api/password.ts": $api_password, "./routes/api/qr-code.ts": $api_qr_code, "./routes/greet/[name].tsx": $greet_name_, diff --git a/routes/_app.tsx b/routes/_app.tsx index 3708775..b1da60c 100644 --- a/routes/_app.tsx +++ b/routes/_app.tsx @@ -5,7 +5,7 @@ export default function App({ Component }: PageProps) { - sl-utils + 🛠️ sl-utils diff --git a/routes/api/mit-license.ts b/routes/api/mit-license.ts new file mode 100644 index 0000000..c1c9a6c --- /dev/null +++ b/routes/api/mit-license.ts @@ -0,0 +1,27 @@ +export const handler = (_req: Request): Response => { + const year = new Date().getFullYear(); + return new Response( + `MIT License + +Copyright (c) ${year} Salvatore Laisa + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.`, + { status: 200, headers: { "Content-Type": "text/plain" } }, + ); +}; diff --git a/routes/index.tsx b/routes/index.tsx index ecc16c8..6c340cc 100644 --- a/routes/index.tsx +++ b/routes/index.tsx @@ -13,6 +13,11 @@ const data = [ methods: "GET", description: "Create a QR code for a given URL", }, + { + endpoint: "/api/mit-license", + methods: "GET", + description: "Precompiled MIT License text", + }, ]; export default function Home() {