
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
This is very much work in progress. I started this to learn a bit more about TypeScript's Decorator support. More coming soon
This package currently only works with TypeScript and is an extension to Express.
You can install this package via npm or yarn.
npm:npm install flachman --save
yarn:yarn add flachmann
import Flachmann from 'flachmann';
const App = Flachmann(yourExpressApp);
const App = Flachmann(yourExpressApp);
@App.Base(config?: BaseConfig)Type: Class Decorator
Info: Registers the class as the main router for the application. Meaning it does not generate any base route.
Config Parameters:
| Property | Type | Required | Description |
|---|---|---|---|
middleware | RequestHandler[] | false | Array of ExpressJS request handlers (middleware) that should be executed on every request to any subroute. |
Example:
@App.Base()
class Api {
@App.get('/')
someMethod() {
return 'Ahoy!'
}
}
// Creates the following endpoints:
// GET / => 'Ahoy!'
@App.Resource(resourceNameOrConfig?: string | ResourceConfig)Type: Class Decorator
Info: Registers the class as a route while taking the class name and turning it into a base route. For this it will modify the name using kebab case and pluralize to determine the the base route.
Config Parameters:
| Property | Type | Required | Description | Example |
|---|---|---|---|---|
name | string | false | Overrides the default behavior of using the class name for the base route. Also does not pluralize or use kebab case | 'demo' |
prefix | boolean | false | URL prefix that will be appended before the name | '/api' |
middleware | RequestHandler[] | false | Array of ExpressJS request handlers (middleware) that should be executed on every request to any subroute. |
Example:
@App.Resource()
class Person {
@App.get('/')
someMethod() {
return 'Ahoy!'
}
}
// Creates the following endpoints:
// GET /people => 'Ahoy!'
@App.get(routeOrConfig: string | RouteConfig) @App.post(routeOrConfig: string | RouteConfig) @App.delete(routeOrConfig: string | RouteConfig) @App.patch(routeOrConfig: string | RouteConfig) @App.put(routeOrConfig: string | RouteConfig)Type: Method Decorator
Info: Registers the method as a route handler using the respective HTTP request type: GET, POST, DELETE, PATCH, PUT. If you don't specify a name it will kebab case the function name.
:warning: Behavior: Unless you set the useResponse config to true the system will check the return value of the method you tagged and send that as a response. Alternatively your method can return a Promise for async operations.
Config Parameters:
| Property | Type | Required | Description | Example |
|---|---|---|---|---|
route | string | false | Overrides the default of using the kebab case version of the function name and let's you specify your own. Supports the same path syntax as ExpressJS | '/hello/:name' |
useResponse | boolean | false | If set to true it will behave like a normal ExpressJS request handler and expect you to use res.send() rather than returning a value or Promise | true |
middleware | RequestHandler[] | false | Array of ExpressJS request handlers (middleware) that should be executed on every request to any subroute. |
Example:
@App.Resource()
class Greeting {
@App.get()
hello(req: Request) {
return 'Hello';
}
@App.get({ useResponse: true })
ahoy(req: Request, res: Response) {
res.status(418).type('text/xml').send('<Say>Ahoy!</Say>');
}
@App.post({
route: '/moin',
middleware: [bodyParser.urlencoded({ extended: false })]
})
someMethodName() {
return 'Moin moin!';
}
@App.delete('/bye')
someOtherMethod() {
return 'Bye :(';
}
}
// Creates the following endpoints:
// GET /greetings/hello => 'Hello'
// GET /greetings/ahoy => <Say>Ahoy!</Say>
// POST /greetings/moin => 'Moin moin!'
// DELETE /greetings/bye => 'Bye :('
@App.all(routeOrConfig: string | RouteConfig)Type: Method Decorator
Info: Behaves the same way as the other method decorators and has the same options. It will respond to all HTTP types though.
Check out the test/test.ts and test/test-resource.ts for example code.
git clone your forked repositorynpm install or yarn inside the documentREADME.md file and test files if necessary.npm testMIT
Dominik Kundel dominik.kundel@gmail.com
FAQs
A decorator based extension of Express
We found that flachmann demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.