rerumaccusamus
Version:
The meta-framework suite designed from scratch for frontend-focused modern web development.
15 lines (11 loc) • 394 B
text/typescript
import path from 'path';
import { createPlugin } from '@modern-js/server-core';
import { injectAPIHandlerInfos, API_DIR } from '@modern-js/bff-utils';
export const APIPlugin = createPlugin(() => ({
prepareApiServer(props, next) {
const { pwd, prefix } = props;
const apiDir = path.resolve(pwd, API_DIR);
injectAPIHandlerInfos(apiDir, prefix);
return next(props);
},
}));