Back to Expressjs

Express.Router

_includes/api/en/4x/express.router.md

latest1.1 KB
Original Source
<h3 id='express.router' class='h2'>express.Router([options])</h3>

Creates a new router object.

js
var router = express.Router([options])

The optional options parameter specifies the behavior of the router.

<div class="table-scroller" markdown="1">
PropertyDescriptionDefaultAvailability
caseSensitiveEnable case sensitivity.Disabled by default, treating "/Foo" and "/foo" as the same.
mergeParamsPreserve the req.params values from the parent router. If the parent and the child have conflicting param names, the child's value take precedence.false4.5.0+
strictEnable strict routing.Disabled by default, "/foo" and "/foo/" are treated the same by the router. 
</div>

You can add middleware and HTTP method routes (such as get, put, post, and so on) to router just like an application.

For more information, see Router.