Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support both Node.js and Bun.js #123

Open
mildronize opened this issue Jan 21, 2024 · 2 comments · Fixed by #133
Open

Support both Node.js and Bun.js #123

mildronize opened this issue Jan 21, 2024 · 2 comments · Fixed by #133
Labels

Comments

@mildronize
Copy link
Collaborator

No description provided.

@mildronize mildronize pinned this issue Jan 21, 2024
@mildronize mildronize changed the title Ability to support both Node.js and Bun.js Support both Node.js and Bun.js Jan 21, 2024
@mildronize
Copy link
Collaborator Author

Hono server will be greater option rather than express.js
https://github.com/honojs/node-server

@mildronize
Copy link
Collaborator Author

propose use of hono

Way 1: Use hono plugin explicitly

import { initNammatham } from "@nammatham/core";
import { AzureFunctionsAdapter } from "@nammatham/azure-functions";
import { honoPlugin } from "@nammatham/hono"

const n = initNammatham.create(new AzureFunctionsAdapter());
const func = n.func;
const app = n.app;

const helloFunction = func
  .httpGet('hello')
  .handler(async ({ trigger, context }) => {
    return { body: `Hello, world!` };
  });

const dev = process.env.NODE_ENV === 'development';
app.register(honoPlugin({ dev }));
app.start();

Way 2: Use hono plugin implicitly

import { initNammatham } from "@nammatham/core";
import { AzureFunctionsAdapter } from "@nammatham/azure-functions";

const n = initNammatham.create(new AzureFunctionsAdapter());
const func = n.func;
const app = n.app;

const helloFunction = func
  .httpGet('hello')
  .handler(async ({ trigger, context }) => {
    return { body: `Hello, world!` };
  });

app.start();

@mildronize mildronize unpinned this issue Feb 17, 2024
@mildronize mildronize linked a pull request May 5, 2024 that will close this issue
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant