main
|
Last change
on this file since e729b88 was c30935a, checked in by Tome <gjorgievtome@…>, 7 months ago |
|
fix config
|
-
Property mode
set to
100644
|
|
File size:
813 bytes
|
| Line | |
|---|
| 1 | import "dotenv/config";
|
|---|
| 2 | import { authjsHandler, authjsSessionMiddleware } from "./authjs-handler";
|
|---|
| 3 | import { dbMiddleware } from "./db-middleware";
|
|---|
| 4 | import telefuncHandler from "./telefunc-handler";
|
|---|
| 5 | import { apply, serve } from "@photonjs/hono";
|
|---|
| 6 | import { Hono } from "hono";
|
|---|
| 7 |
|
|---|
| 8 | const port = process.env.PORT ? parseInt(process.env.PORT, 10) : 3000;
|
|---|
| 9 |
|
|---|
| 10 | export default startServer() as unknown;
|
|---|
| 11 |
|
|---|
| 12 | function startServer() {
|
|---|
| 13 | const app = new Hono();
|
|---|
| 14 |
|
|---|
| 15 | apply(app, [
|
|---|
| 16 | // Make database available in Context as `context.db`
|
|---|
| 17 | dbMiddleware,
|
|---|
| 18 |
|
|---|
| 19 | // Append Auth.js session to context
|
|---|
| 20 | authjsSessionMiddleware,
|
|---|
| 21 |
|
|---|
| 22 | // Auth.js route. See https://authjs.dev/getting-started/installation
|
|---|
| 23 | authjsHandler,
|
|---|
| 24 |
|
|---|
| 25 | // Telefunc route. See https://telefunc.com
|
|---|
| 26 | telefuncHandler,
|
|---|
| 27 | ]);
|
|---|
| 28 |
|
|---|
| 29 | return serve(app, {
|
|---|
| 30 | port,
|
|---|
| 31 | });
|
|---|
| 32 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.