Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

let them bookmark and we keep app state at initial load by passing url to $routeProvider #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ app.use(express.methodOverride());
app.use(express.static(path.join(__dirname, 'public')));
app.use(app.router);

// middleware function puts hash before req.params
// redirect logic falls back to angular $routeProvider
app.use(function(req, res) {
return res.redirect(req.protocol + '://' + req.get('Host') + '/#' + req.url)
});

// development only
if (app.get('env') === 'development') {
app.use(express.errorHandler());
Expand All @@ -48,9 +54,6 @@ app.get('/partials/:name', routes.partials);
// JSON API
app.get('/api/name', api.name);

// redirect all others to the index (HTML5 history)
app.get('*', routes.index);


/**
* Start Server
Expand Down