Skip to content

Commit

Permalink
5 - Node Directory Structure
Browse files Browse the repository at this point in the history
  • Loading branch information
hollylawly committed Aug 30, 2016
1 parent 5d80279 commit be03162
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 25 deletions.
Empty file added about.html
Empty file.
21 changes: 21 additions & 0 deletions app/routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// require express
var express = require('express');

// create our router object
var router = express.Router();

// export our router
module.exports = router;

// route for our homepage
router.get('/', function(req, res) {
res.send('hello world again!');
});

// route for our about page
router.get('/about', function(req, res) {
res.send('hello world i am the about page!');
});

router.get('/contact');
router.post('/contact');
Empty file added contact.html
Empty file.
Empty file added index.html
Empty file.
Empty file added public/css/styles.css
Empty file.
31 changes: 6 additions & 25 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,16 @@
// // import the http module
// var http = require('http');

// // handle sending requests and returning responses
// function handleRequests(req, res) {
// // return string
// res.end('Hello world!');
// }

// // create the server
// var server = http.createServer(handleRequests);

// // start server and listen on port x
// server.listen(8080, function() {
// console.log('Listening on port 8080');
// });



/////////////// EXPRESS //////////////////////


// require our dependencies
var express = require('express');
var app = express();
var port = 8080;

// route our app
var router = require('./app/routes');
app.use('/', router);


// start the server
app.listen(port, function() {
console.log('app started');
});

// route our app
app.get('/', function(req, res) {
res.send('hello world again!');
});

0 comments on commit be03162

Please sign in to comment.