typedserver/ts/servertools/classes.handlertypedrouter.ts

20 lines
573 B
TypeScript
Raw Normal View History

2024-02-20 16:30:46 +00:00
import * as plugins from '../plugins.js';
2023-03-30 13:15:48 +00:00
import { Handler } from './classes.handler.js';
2024-05-11 10:51:20 +00:00
import * as interfaces from '../../dist_ts_interfaces/index.js';
2023-03-30 13:15:48 +00:00
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);
2024-02-21 00:16:39 +00:00
res.type('json');
res.write(plugins.smartjson.stringify(response));
res.end();
2023-03-30 13:15:48 +00:00
});
}
}