singlepage

In a single-page app, what is the right way to deal with wrong URLs (404 errors)?

有些话、适合烂在心里 提交于 2019-11-30 04:11:13
I am currently writing a web application using angularjs, but I think this question applies to any client-side javascript framework that does routing on the client side ( as angular does ). In a single-page app, what is the right way to deal with wrong URLs? Looking at a few major sites, I see that gmail will redirect to the inbox if you type any random URL below https://mail.google.com/mail/ . This happens server-side (with an http 300 code) or client-side, depending on whether the wrong path is before or after the # character. On the other hand, twitter shows a real HTTP 404 for any invalid

Configuring nginx for single page website with HTML5 push state URL's

早过忘川 提交于 2019-11-29 23:12:44
How can I configure nginx to redirect all URL's (not prepended with /api or some static resource eg. JS/images) to index.html ? Reason is I am using HTML5 push state URL's with a single page application. Meaning content is changed whether AJAX or JS depending on the URL My current nginx config looks like: server { listen 2000; server_name localhost; location / { root /labs/Projects/Nodebook/public; index index.html; } location /api/ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX

Reusing backbone views/routes on the server when using Backbone.js pushstate for seo/bookmarking

余生颓废 提交于 2019-11-28 23:48:49
I'm doing some due diligence on backbone for a single page app and wonder if it is possible to re-use the same views/routes from the client on the server side, so that when google visits a pushstate URL, or it is accessed directly, the server can generate the exact same HTML that would be generated by backbone in the client. It would be a pain to have to maintain two separate sets of views/routes, one on the client and one on the server. I have seen the backnode project on github however this seems to miss the point a bit and you end up having to write the same backbone router twice. Just

Configuring nginx for single page website with HTML5 push state URL's

旧时模样 提交于 2019-11-28 20:36:07
问题 How can I configure nginx to redirect all URL's (not prepended with /api or some static resource eg. JS/images) to index.html ? Reason is I am using HTML5 push state URL's with a single page application. Meaning content is changed whether AJAX or JS depending on the URL My current nginx config looks like: server { listen 2000; server_name localhost; location / { root /labs/Projects/Nodebook/public; index index.html; } location /api/ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header

Architecture of a single-page JavaScript web application?

痴心易碎 提交于 2019-11-28 02:33:34
How should a complex single-page JS web application be structured on the client-side? Specifically I'm curious about how to cleanly structure the application in terms of its model objects, UI components, any controllers, and objects handling server persistence. MVC seemed like a fit at first. But with UI components nested at various depths (each with their own way of acting on/reacting to model data, and each generating events which they themselves may or may not handle directly), it doesn't seem like MVC can be cleanly applied. (But please correct me if that's not the case.) -- ( This

JavaScript frameworks to build single page applications [closed]

好久不见. 提交于 2019-11-27 16:37:15
My goal is to migrate an existing web application to a RESTful single page application (SPA). Currently, I'm evaluating several Javascript web application frameworks. My requirements are as follow: RESTful data layer (like ember-data) MV*-structure Dynamic routes Testing-support Coding by convention SEO-support Browser-History-Support Good (API-) documentation Production-ready Living community Backbone The current application is using backbone.js . Overall, backbone.js is a nice project, but I'm missing well-defined structures that determine where what has to happen and how things must get

AngularJs ReferenceError: angular is not defined

匆匆过客 提交于 2019-11-27 15:02:12
I trying to add a custom filter, but if I use the following code: angular.module('myApp',[]).filter('startFrom', function() { return function(input, start) { start = +start; //parse to int return input.slice(start); } }); But if I do so, I get: "ReferenceError: angular is not defined" in firebug. The rest of application is working fine, I am using ng-app in a tag div not in tag html, and https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js Vũ Ngô You should put the include angular line first, before including any other js file I faced similar issue due to local vs remote

“Single-page” JS websites and SEO

余生长醉 提交于 2019-11-27 05:46:50
There are a lot of cool tools for making powerful "single-page" JavaScript websites nowadays. In my opinion, this is done right by letting the server act as an API (and nothing more) and letting the client handle all of the HTML generation stuff. The problem with this "pattern" is the lack of search engine support. I can think of two solutions: When the user enters the website, let the server render the page exactly as the client would upon navigation. So if I go to http://example.com/my_path directly the server would render the same thing as the client would if I go to /my_path through

Architecture of a single-page JavaScript web application?

て烟熏妆下的殇ゞ 提交于 2019-11-27 04:55:48
问题 How should a complex single-page JS web application be structured on the client-side? Specifically I'm curious about how to cleanly structure the application in terms of its model objects, UI components, any controllers, and objects handling server persistence. MVC seemed like a fit at first. But with UI components nested at various depths (each with their own way of acting on/reacting to model data, and each generating events which they themselves may or may not handle directly), it doesn't

“Single-page” JS websites and SEO

无人久伴 提交于 2019-11-27 03:58:30
问题 There are a lot of cool tools for making powerful "single-page" JavaScript websites nowadays. In my opinion, this is done right by letting the server act as an API (and nothing more) and letting the client handle all of the HTML generation stuff. The problem with this "pattern" is the lack of search engine support. I can think of two solutions: When the user enters the website, let the server render the page exactly as the client would upon navigation. So if I go to http://example.com/my_path