Skip to content

Commit

Permalink
feat(klesia): add port override
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcnk committed Sep 8, 2024
1 parent 8fdaf93 commit 8b296dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions apps/klesia/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
PORT=3000
MINA_NETWORK=devnet
NODE_API_DEVNET=https://api.minascan.io/node/devnet/v1/graphql
NODE_API_MAINNET=https://api.minascan.io/node/mainnet/v1/graphql
Expand Down
9 changes: 7 additions & 2 deletions apps/klesia/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "dotenv/config";
import { serve } from "@hono/node-server";
import { getConnInfo } from "@hono/node-server/conninfo";
import { OpenAPIHono, createRoute } from "@hono/zod-openapi";
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
import { PublicKeySchema } from "@mina-js/shared";
import { rateLimiter } from "hono-rate-limiter";
import { cors } from "hono/cors";
Expand Down Expand Up @@ -142,7 +142,12 @@ export const klesiaRpcRoute = api.openapi(rpcRoute, async ({ req, json }) => {
.exhaustive();
});

serve(api);
serve(
{ fetch: api.fetch, port: z.coerce.number().parse(process.env.PORT ?? 3000) },
(info) => {
console.log(`Listening on http://localhost:${info.port}`);
},
);

export type KlesiaRpc = typeof klesiaRpcRoute;
export {
Expand Down

0 comments on commit 8b296dd

Please sign in to comment.