Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add app.router documentation #1129

Merged
merged 1 commit into from
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions _includes/api/en/5x/app-router.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<h3 id='app.router'>app.router</h3>

The application's in-built instance of router. This is created lazily, on first access.

```js
var express = require('express')
var app = express()
var router = app.router

router.get('/', function (req, res) {
res.send('hello world')
})

app.listen(3000)
```

You can add middleware and HTTP method routes to the `router` just like an application.

For more information, see [Router](#router).
4 changes: 4 additions & 0 deletions _includes/api/en/5x/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ The Express application object can be referred from the [request object](#req) a
{% include api/en/5x/app-mountpath.md %}
</section>

<section markdown="1">
{% include api/en/5x/app-router.md %}
</section>

<h3 id='app.events'>Events</h3>

<section markdown="1">
Expand Down
2 changes: 2 additions & 0 deletions _includes/api/en/5x/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
</li>
<li><a href="#app.mountpath">app.mountpath</a>
</li>
<li><a href="#app.router">app.router</a>
</li>
<li><em>Events</em>
</li>
<li><a href="#app.onmount">mount</a>
Expand Down