forked from scotch-io/node-website-course
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d80279
commit be03162
Showing
6 changed files
with
27 additions
and
25 deletions.
There are no files selected for viewing
Empty file.
This file contains 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
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.
Empty file.
Empty file.
This file contains 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
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!'); | ||
}); |