Created
          November 8, 2013 21:51 
        
      - 
      
- 
        Save facultymatt/7378275 to your computer and use it in GitHub Desktop. 
    Simple server
  
        
  
    
      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
    
  
  
    
  | /** | |
| * Add express to package.json | |
| * Keep the app.get('*') for nice sinlge page app support | |
| * | |
| */ | |
| var express = require("express"), | |
| app = express(), | |
| port = parseInt(process.env.PORT, 10) || 4567; | |
| app.configure(function() { | |
| app.use(express.methodOverride()); | |
| app.use(express.bodyParser()); | |
| app.use(express.static(__dirname + '/app')); | |
| app.use(express.errorHandler({ | |
| dumpExceptions: true, | |
| showStack: true | |
| })); | |
| app.use(app.router); | |
| }); | |
| // send all non-api requests to our main index.html page, which starts our app | |
| // this is a nice way to support non hash links on single page apps... and why we started using | |
| // angular and genesis in the first place <3 | |
| app.get('*', function(req, res, next) { | |
| res.redirect('/#' + req.url); | |
| }); | |
| app.listen(port, function() { | |
| console.log("Express server listening on port " + port); | |
| }); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Note if this is not root level, use
app.use(express.static(path.join(__dirname, '../app')));or similar.