Templateimport type { TypedRequestHandlers } from './typedRequestHandler';
import type { Paths, Operations } from './types';
import express from 'express';
const handlers: TypedRequestHandlers<Paths, Operations> = {
'GET /example': (req, res) => {
res.send({ message: 'Example GET handler' });
},
exampleOperation: (req, res) => {
res.send({ message: 'Example operation handler' });
},
};
const app = express();
app.get('/example', handlers['GET /example']);
app.post('/exampleOperation', handlers.exampleOperation);
Represents a collection of request handlers that are typed based on the provided
PathsandOperationstemplates generated from the openapi. This type combines both operation-specific handlers and path-specific handlers.Paths - A template that defines the structure of the paths. Operations - A template that defines the structure of the operations.