generated from nhcarrigan/template
This commit is contained in:
@@ -5,9 +5,11 @@
|
||||
*/
|
||||
|
||||
import fastify from "fastify";
|
||||
import { processFormSubmission } from "../modules/processFormSubmission.js";
|
||||
import { processGithubEvent } from "../modules/processGitHubEvent.js";
|
||||
import { logger } from "../utils/logger.js";
|
||||
import type { Amari } from "../interfaces/amari.js";
|
||||
import type { FormSubmission } from "../interfaces/formSubmission.js";
|
||||
import type { GithubPayload } from "../interfaces/github.js";
|
||||
|
||||
const html = `<!DOCTYPE html>
|
||||
@@ -79,6 +81,19 @@ export const instantiateServer = (amari: Amari): void => {
|
||||
}
|
||||
});
|
||||
|
||||
server.
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- Fastify standard.
|
||||
post<{ Body: FormSubmission }>("/form", async(request, response) => {
|
||||
try {
|
||||
await processFormSubmission(amari, request, response);
|
||||
} catch (error) {
|
||||
if (!(error instanceof Error)) {
|
||||
return;
|
||||
}
|
||||
await logger.error("/form route", error);
|
||||
}
|
||||
});
|
||||
|
||||
server.listen({ port: 7044 }, (error) => {
|
||||
if (error) {
|
||||
void logger.error("instantiate server", error);
|
||||
|
||||
Reference in New Issue
Block a user