mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 20:16:58 +00:00
18 lines
472 B
TypeScript
18 lines
472 B
TypeScript
|
import Mock from 'mockjs';
|
||
|
import * as resources from './resources';
|
||
|
|
||
|
export default {
|
||
|
'/api/:resource::action': (req: any, res: any) => {
|
||
|
const action = resources[req.params.resource][req.params.action];
|
||
|
if (action) {
|
||
|
return action(req, res);
|
||
|
}
|
||
|
},
|
||
|
'/api/:resource::action/:resourceIndex': (req: any, res: any) => {
|
||
|
const action = resources[req.params.resource][req.params.action];
|
||
|
if (action) {
|
||
|
return action(req, res);
|
||
|
}
|
||
|
},
|
||
|
}
|