Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@honojs/node-server
Advanced tools
This project is still experimental.
This is HTTP Server for Hono on Node.js. Hono is ultrafast web framework for Cloudflare Workers, Deno, and Bun. It's not for Node.js. BUT, there may be a case that you really want to run on Node.js. This library is an adapter server that connects Hono and Node.js.
Hono is ultra fast, but not so fast on Node.js, because there is an overhead to adapt Hono's API to Node.js.
By the way, it is 2.x times faster than Express.
You can install from npm registry with npm
command:
npm install @honojs/node-server
Or use yarn
:
yarn add @honojs/node-server
Just import @honojs/node-server
at the top and write the code as usual.
The same code that runs on Cloudflare Workers, Deno, and Bun will work.
import { serve } from '@honojs/node-server' // Write above `Hono`
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => c.text('Hono meets Node.js'))
serve(app)
For example, run it using ts-node
. Then an HTTP server will be launched. The default port is 3000
.
ts-node ./index.ts
Open http://localhost:3000
with your browser.
serve({
fetch: app.fetch,
port: 8787, // Port number, default is 3000
})
Most built-in middleware also works with Node.js. Read the documentation and use the Middleware of your liking.
import { serve } from '@honojs/node-server'
import { Hono } from 'hono'
import { prettyJSON } from 'hono/pretty-json'
const app = new Hono()
app.get('*', prettyJSON())
app.get('/', (c) => c.json({ 'Hono meets': 'Node.js' }))
serve(app)
Use Serve Static Middleware that has been created for Node.js.
import { serve, serveStatic } from '@honojs/node-server'
//...
app.use('/static/*', serveStatic({ root: './' }))
Yusuke Wada https://github.com/yusukebe
MIT
FAQs
HTTP Server for Hono on Node.js
The npm package @honojs/node-server receives a total of 3 weekly downloads. As such, @honojs/node-server popularity was classified as not popular.
We found that @honojs/node-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.