summaryrefslogtreecommitdiff
path: root/server/index.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <me@liz.coffee>2025-06-29 17:31:30 -0700
committerElizabeth Hunt <me@liz.coffee>2025-06-29 17:31:30 -0700
commit58be1809c46cbe517a18d86d0af52179dcc5cbf6 (patch)
tree9ccc678b3fd48c1a52fe501600dd2c2051740a55 /server/index.ts
parentd4791f3d357634daf506fb8f91cc5332a794c421 (diff)
downloadci-58be1809c46cbe517a18d86d0af52179dcc5cbf6.tar.gz
ci-58be1809c46cbe517a18d86d0af52179dcc5cbf6.zip
Move to nodejs and also lots of significant refactoring that should've been broken up but idgaf
Diffstat (limited to 'server/index.ts')
-rw-r--r--server/index.ts32
1 files changed, 7 insertions, 25 deletions
diff --git a/server/index.ts b/server/index.ts
index c33b43e..d018a4e 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -1,31 +1,13 @@
#!/usr/bin/env node
-export * from './job';
-export * from './ci';
-export * from './health';
+export * from './job/index.js';
+export * from './ci.js';
+export * from './health.js';
+export * from './hono_proxy.js';
-import { CiHookServer } from '.';
-import { Either, type IEither } from '@emprespresso/pengueno';
-import { serve } from '@hono/node-server';
-import { Hono } from 'hono';
+import { CiHookServer, HonoProxy } from '@emprespresso/ci_server';
const server = new CiHookServer();
+const hono = new HonoProxy(server);
-const neverEndingPromise = new Promise<IEither<Error, 0>>(() => {});
-export const runServer = (port: number, host: string): Promise<IEither<Error, 0>> =>
- Either.fromFailable<Error, void>(() => {
- const app = new Hono();
-
- app.all('*', async (c) => {
- const response = await server.serve(c.req.raw);
- return response;
- });
-
- serve({
- fetch: app.fetch,
- port,
- hostname: host,
- });
-
- console.log(`server running on http://${host}:${port} :D`);
- }).flatMapAsync(() => neverEndingPromise);
+export const runServer = (port: number, hostname: string) => hono.serve(port, hostname);