栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

使用Node.js Express服务器使用Backbone.js pushState路由吗?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

使用Node.js Express服务器使用Backbone.js pushState路由吗?

说明

首先,您需要知道

domain.com/#/about
它将调用服务器的“
/”路由,因为它不读取#片段。您的服务器将呈现Backbone.js应用程序的基础,而Backbone将触发“关于”路线。

因此,您需要在Express JS中声明两条路由:

  • /
  • /关于

app.get('/', function(req, res) {    // Trigger the routes 'domain.com' and 'domain.com/#/about'    // Here render the base of your application});app.get('/about', function (req, res) {    // Trigger the route 'domain.com/about'    // Here use templates to generate the right view and render});

我建议您通过Derick Bailey与Backbone.js实现SEO兼容性的3个链接:

  • HTML5 PushState的SEO和可访问性,第1部分:PushState简介: http **://lostechies.com/derickbailey/2011/09/26/seo-and-accessibility-with-html5-pushstate-part-1-introducing-pushstate/**
  • HTML5 PushState的SEO和可访问性,第2部分:Backbone.js的渐进增强: http **://lostechies.com/derickbailey/2011/09/26/seo-and-accessibility-with-html5-pushstate-part-2-progressive** -加强与骨干js /
  • 使用HTML5 PushState进行SEO和可访问性,第3部分:视频: http **://lostechies.com/derickbailey/2011/10/06/seo-and-accessibility-with-html5-pushstate-part-3-the-video/**


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/436747.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号