generated from danurbanowicz/eleventy-netlify-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 55-feat-add-activitypub
- Loading branch information
Showing
9 changed files
with
874 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ _gemini/ | |
node_modules/ | ||
dist/ | ||
.DS_Store | ||
|
||
# Local Netlify folder | ||
.netlify |
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 |
---|---|---|
@@ -1 +1 @@ | ||
16 | ||
18 |
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,33 @@ | ||
import express, { Router, Request, Response } from "express"; | ||
import serverless from "serverless-http"; | ||
import os from "os"; | ||
|
||
const api = express(); | ||
|
||
const router = Router(); | ||
router.get("/hello", (req, res) => res.send("Hello World!")); | ||
|
||
// Echo route | ||
router.get("/echo", (req: Request, res: Response) => { | ||
const echo = { | ||
path: req.path, | ||
headers: req.headers, | ||
method: req.method, | ||
body: req.body, | ||
cookies: req.cookies, | ||
hostname: req.hostname, | ||
ip: req.ip, | ||
protocol: req.protocol, | ||
query: req.query, | ||
subdomains: req.subdomains, | ||
os: { | ||
hostname: os.hostname() | ||
}, | ||
}; | ||
|
||
res.json(echo); | ||
}); | ||
|
||
api.use("/api/", router); | ||
|
||
export const handler = serverless(api); |
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,5 @@ | ||
import type { Context } from "@netlify/functions" | ||
|
||
export default async (req: Request, context: Context) => { | ||
return new Response("Hello, world!") | ||
} |
Oops, something went wrong.