Express MapExpress 应用组件
Express Map 可以通过组装 Express 应用程序路径配置,来与客户端进行共享。
示例代码:
// Map our paths using Express Map app.map('/blog/', 'blog'); app.map('/blog/:post', 'blog-post'); // Annotate our paths using Express Annotations app.annotate('/blog/', {section: 'blog'}); app.annotate('/blog/:post', {section: 'blog'}); // Set up our actual routes app.get('/blog/', function (req, res) { //Render the template for '/blog/' here}); app.get('/blog/:post', function (req, res) { // Render the template for '/blog/:post' here});
评论