-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#79 introduced express to better manage google function routes with z…
…od validation
- Loading branch information
Showing
6 changed files
with
138 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import * as functions from "firebase-functions"; | ||
import {sendResponseMessage} from "./utils"; | ||
import {Response} from "express"; | ||
|
||
const helloWorld = functions.https.onRequest((request, response) => { | ||
functions.logger.info("Hello voxxrin logs!", {structuredData: true}); | ||
return sendResponseMessage(response, 200, "Hello from Voxxrin!"); | ||
}); | ||
|
||
export default helloWorld | ||
export default async (response: Response, pathParams: {}, queryParams: {who?: string}) => { | ||
functions.logger.info("Hello voxxrin logs!", {structuredData: true}); | ||
return sendResponseMessage(response, 200, `Hello ${queryParams.who || "nobody"} from Voxxrin!`); | ||
}; |
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,10 @@ | ||
import {Routes} from "./utils"; | ||
import * as z from "zod"; | ||
import type {Express} from 'express'; | ||
import helloWorld from "./hello"; | ||
|
||
export function declareExpressHttpRoutes(app: Express) { | ||
// For testing purposes only | ||
Routes.get(app, `/helloWorld`, z.object({ query: z.object({ who: z.string().optional() })}), helloWorld); | ||
|
||
} |
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