Noir::EggRouterExtractor
Egg.js router registrations, as written in app/router.js and the
app/router/** files it requires:
router.get('/users/:id', controller.user.show) router.post('login', '/login', auth, 'user.login') // named route app.router.resources('posts', '/api/posts', controller.posts) const v1 = router.namespace('/v1'); v1.get('/ping', controller.ping.index)
As in egg-core's router argument parsing, a second string argument is the path only when three or more arguments are passed, and the last argument is the controller.
Constants
CALL = /(?<![\w$.])((?:app\.)?[A-Za-z_$][\w$]*)\s*\.\s*(get|post|put|patch|delete|del|head|options|all|resources|redirect)\s*\(/
NAMESPACE = /(?<![\w$.])(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:app\.)?router\s*\.\s*namespace\s*\(\s*(['"`])([^'"`]+)\2/