Created
February 27, 2014 04:55
-
-
Save iamblue/9244610 to your computer and use it in GitHub Desktop.
use nodejs middleware to seperate SEO source
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.use(function(req, res, next) { | |
| var frag = req.query._escaped_fragment_; | |
| if (!frag) return next(); | |
| if (frag){ | |
| //處理指向的對應route | |
| } | |
| try { | |
| var file = __dirname + "/snapshots" + frag; | |
| res.sendfile(file); | |
| } catch (err) { | |
| res.send(404); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment