
Product
Socket Now Protects the Chrome Extension Ecosystem
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
@hono/tsyringe
Advanced tools
The tsyringe middleware provides a way to use dependency injection in Hono.
import "reflect-metadata" // tsyringe requires reflect-metadata or polyfill
import { container, inject, injectable } from 'tsyringe'
import { tsyringe } from '@hono/tsyringe'
import { Hono } from 'hono'
@injectable()
class Hello {
constructor(@inject('name') private name: string) {}
greet() {
return `Hello, ${this.name}!`
}
}
const app = new Hono()
app.use('*', tsyringe((container) => {
container.register('name', { useValue: 'world' })
}))
app.get('/', (c) => {
const hello = container.resolve(Hello)
return c.text(hello.greet())
})
export default app
const app = new Hono()
app.use('/tenant/:name/*', async (c, next) => {
await tsyringe((container) => {
// Allowing to inject `c.var` or `c.req.param` in the providers
const tenantName = c.req.param('name')
container.register(Config, { useFactory: () => new Config(tenantName) })
})(c, next)
})
Aotokitsuruya https://github.com/elct9620
MIT
FAQs
The tsyringe dependency injection middleware for Hono
The npm package @hono/tsyringe receives a total of 390 weekly downloads. As such, @hono/tsyringe popularity was classified as not popular.
We found that @hono/tsyringe demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.