wayBetter for X
This commit is contained in:
commit
434f193217
720 changed files with 147465 additions and 0 deletions
20
apps/api/src/index.ts
Normal file
20
apps/api/src/index.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { serve } from '@hono/node-server';
|
||||
import { serveStatic } from '@hono/node-server/serve-static';
|
||||
import { resolve } from 'node:path';
|
||||
import { createApp } from './app.js';
|
||||
|
||||
const port = Number(process.env.PORT ?? 8787);
|
||||
// Bind to loopback by default: the API is reached through Cloudflare Tunnel, never a public port.
|
||||
const hostname = process.env.HOST ?? '127.0.0.1';
|
||||
const app = createApp({
|
||||
releasesDir: resolve(process.env.RELEASES_DIR ?? './releases'),
|
||||
basePath: process.env.BASE_PATH ?? '',
|
||||
version: process.env.npm_package_version,
|
||||
// Landing page build (relative to the process cwd, the repo root under pm2).
|
||||
web: process.env.WEB_DIR ? serveStatic({ root: process.env.WEB_DIR }) : undefined,
|
||||
notFoundPage: process.env.WEB_DIR ? resolve(process.env.WEB_DIR, '404.html') : undefined,
|
||||
});
|
||||
|
||||
serve({ fetch: app.fetch, port, hostname }, info => {
|
||||
console.log(`[api] listening on http://${info.address}:${info.port}`);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue