Created
November 12, 2017 19:36
-
-
Save robertcoopercode/f9186cbffaa68eb46345ae9b5aa7d11e to your computer and use it in GitHub Desktop.
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
// Require express and create an express application instance | |
const express = require('express'); | |
const app = express(); | |
// Require the express routes defined in router.js | |
const routes = require('./router'); | |
// Define the hostname and port where the server can be found | |
const hostname = "127.0.0.1"; | |
const port = 3000; | |
// Define the directory where static files are found | |
app.use(express.static('public')); | |
// Specify the routes to be used for our application | |
app.use(routes); | |
// Begin accepting connections to the specified port | |
app.listen(port, () => { | |
// Display server location information to the console | |
console.log(`Server is listening at http://${hostname}:${port}/`); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment