UNPKG

@sodacore/ws

Version:

Sodacore ws is a core plugin that extends the Http plugin offering WebSocket support to the Sodacore framework.

15 lines (14 loc) 486 B
import { Utils } from '@sodacore/di'; /** * Will define a class a middleware, make sure to * implement the IMiddleware interface. * @returns ClassDecorator */ export default function Middleware() { return (target) => { Utils.setMeta('type', 'autowire')(target, 'middleware'); const services = Utils.getMeta('services', 'controller')(target, undefined, []); services.push('ws'); Utils.setMeta('services', 'controller')(target, services); }; }