typedserver/ts/servertools/classes.handlertypedrouter.ts
2024-02-21 01:16:39 +01:00

20 lines
562 B
TypeScript

import * as plugins from '../plugins.js';
import { Handler } from './classes.handler.js';
import * as interfaces from '../interfaces/index.js';
export class HandlerTypedRouter extends Handler {
/**
* The constuctor of HandlerProxy
* @param remoteMountPointArg
*/
constructor(typedrouter: plugins.typedrequest.TypedRouter) {
super('POST', async (req, res) => {
const response = await typedrouter.routeAndAddResponse(req.body);
res.type('json');
res.write(plugins.smartjson.stringify(response));
res.end();
});
}
}