typedserver/ts/servertools/classes.handlertypedrouter.ts
2024-05-11 12:51:20 +02:00

20 lines
573 B
TypeScript

import * as plugins from '../plugins.js';
import { Handler } from './classes.handler.js';
import * as interfaces from '../../dist_ts_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();
});
}
}