Express MapExpress 应用组件

联合创作 · 2023-09-22 06:55

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});
浏览 4
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报