Skip to content
Myr

docs for app.lookup.VERB()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 45faee3 · Browse files · 1 file+37 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+37 added−0 removed

  • other:+37 added−0 removed

1 file+37 added−0 removed

modified:docs/guide.md+37 added
1166 unmodified lines
1167All views would now have _session_ available so that session data can be accessed via _session.name_ etc:11681169 <%= session.name %>11701171### app.lookup11721173 The _app.lookup_ http methods returns an array of callback functions1174 associated with the given _path_.11751176 Suppose you define the following routes:1177 1178 app.get('/user/:id', function(){});1179 app.get('/user/:id/op?', function(){});1180 app.put('/user/:id', function(){});11811182 We can utilize this lookup functionality to check which routes1183 have been defined, which can be extremely useful for higher level1184 frameworks built on Express.11851186 app.lookup.get('/user/:id');1187 // => [Function]11881189 app.lookup.get('/user/:id/op?');1190 // => [Function]11911192 app.lookup.put('/user/:id');1193 // => [Function]11941195 app.lookup.all('/user/:id');1196 // => [Function, Function]11971198 app.lookup.all('/hey');1199 // => []12001201 To alias _app.lookup.VERB()_, we can simply invoke _app.VERB()_1202 without a callback, as a shortcut, for example the following are1203 equivalent:1204 1205 app.lookup.get('/user');1206 app.get('/user');12071208### app.mounted(fn)12091210Assign a callback _fn_ which is called when this _Server_ is passed to _Server#use()_.1211
65 unmodified lines