HelloZeroNet / ZeroNet

ZeroNet - Decentralized websites using Bitcoin crypto and BitTorrent network
https://zeronet.io
Other
18.38k stars 2.27k forks source link

[Change request] "Angular Component Router" support #603

Closed rognoni closed 8 years ago

rognoni commented 8 years ago

For my ZeroNet(Werkzeug)-based project I'll use Angular2 routing instead of CoffeeScript, for example http://127.0.0.1:5000/detail/11 but I'll see this error:

Not Found

The requested URL was not found on the server.
If you entered the URL manually please check your spelling and try again.
import os.path
from flask import Flask
from werkzeug.wsgi import SharedDataMiddleware

app = Flask(__name__)

app.wsgi_app = SharedDataMiddleware(app.wsgi_app, {
    '/': os.path.join(os.path.dirname(__file__), '.')
})

This is the lite-server description of this feature:

When creating a SPA there are routes that are only known to the browser. For example, /customer/21 may be a client side route for an Angular app. If this route is entered manually or linked to directly as the entry point of the Angular app (aka a deep link) the static server will receive the request, because Angular is not loaded yet. The server will not find a match for the route and thus return a 404. The desired behavior in this case is to return the index.html (or whatever starting page of the app we have defined).

Original request here: https://github.com/pallets/werkzeug/issues/1016

HelloZeroNet commented 8 years ago

ZeroNet does not have any server-side (python code) support, so I don't think it's related in any way