Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. Cannot GET /
  2.  
  3. // set up ======================================================================
  4. var express = require('express');
  5. var app = express(); // create our app w/ express
  6. var port = process.env.PORT || 8080; // set the port
  7. var morgan = require('morgan'); // log requests to the console (express4)
  8. var bodyParser = require('body-parser'); // pull information from HTML POST (express4)
  9. var methodOverride = require('method-override'); // simulate DELETE and PUT (express4)
  10.  
  11. app.use(express.static(__dirname + '/public')); // set the static files location /public/img will be /img for users
  12. app.use(morgan('dev')); // log every request to the console
  13. app.use(bodyParser.urlencoded({'extended':'true'})); // parse application/x-www-form-urlencoded
  14. app.use(bodyParser.json()); // parse application/json
  15. app.use(bodyParser.json({ type: 'application/vnd.api+json' })); // parse application/vnd.api+json as json
  16. app.use(methodOverride());
  17. app.use('/scripts', express.static(__dirname + '/node_modules/'));
  18.  
  19. // load the routes
  20. require('./router');
  21.  
  22. // listen (start app with node server.js) ======================================
  23. app.listen(port);
  24. console.log("App listening on port " + port);
  25.  
  26. router.get('*', function(req, res) {
  27. console.log('inside / route!');
  28. res.sendfile('./client/index.html'); // load the single view file (angular will handle the front-end)
  29. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement