Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hono/node-server

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hono/node-server - npm Package Compare versions

Comparing version 0.5.1 to 0.6.0

3

dist/server.d.ts
import { Server } from 'node:http';
import { Options } from './types';
import type { AddressInfo } from 'node:net';
export declare const createAdaptorServer: (options: Options) => Server;
export declare const serve: (options: Options) => Server;
export declare const serve: (options: Options, listeningListener?: ((info: AddressInfo) => void) | undefined) => Server;

@@ -11,11 +11,15 @@ "use strict";

const requestListener = (0, listener_1.getRequestListener)(fetchCallback);
const server = (0, node_http_1.createServer)(options.serverOptions || {}, requestListener);
const createServer = options.createServer || node_http_1.createServer;
const server = createServer(options.serverOptions || {}, requestListener);
return server;
};
exports.createAdaptorServer = createAdaptorServer;
const serve = (options) => {
const serve = (options, listeningListener) => {
const server = (0, exports.createAdaptorServer)(options);
server.listen(options.port || 3000, options.hostname || '0.0.0.0');
server.listen(options?.port ?? 3000, options.hostname ?? '0.0.0.0', () => {
const serverInfo = server.address();
listeningListener && listeningListener(serverInfo);
});
return server;
};
exports.serve = serve;

@@ -0,3 +1,5 @@

/// <reference types="node" />
import type { Hono } from 'hono';
import type { NextApiHandler } from 'next/types';
import type { createServer } from 'node:http';
export declare type FetchCallback = (request: Request) => Promise<unknown> | unknown;

@@ -12,2 +14,3 @@ export declare type NextHandlerOption = {

serverOptions?: Object;
createServer?: typeof createServer;
};

@@ -14,0 +17,0 @@ export interface HandleInterface {

{
"name": "@hono/node-server",
"version": "0.5.1",
"version": "0.6.0",
"description": "HTTP Server for Hono on Node.js",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

# Hono on Node.js
**`@honojs/node-server` is renamed to `@hono/node-server` !!**
---
This is **HTTP Server for Hono on Node.js**.

@@ -42,3 +38,5 @@ Hono is ultrafast web framework for Cloudflare Workers, Deno, and Bun.

serve(app)
serve(app, (info) => {
console.log(`Listening on http://localhost:${info.port}`) // Listening on http://localhost:3000
})
```

@@ -56,2 +54,4 @@

### `port`
```ts

@@ -64,2 +64,20 @@ serve({

### `createServer`
```ts
import { createServer } from 'node:https'
import fs from 'node:fs'
//...
serve({
fetch: app.fetch,
createServer: createServer,
serverOptions: {
key: fs.readFileSync('test/fixtures/keys/agent1-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent1-cert.pem'),
},
})
```
## Middleware

@@ -66,0 +84,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc