Skip to content

Instantly share code, notes, and snippets.

@adammcarth
Created August 4, 2014 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adammcarth/6039a65a9ea7b4a36019 to your computer and use it in GitHub Desktop.
Save adammcarth/6039a65a9ea7b4a36019 to your computer and use it in GitHub Desktop.
// Require express to handle our http stuff later on.
var express = require("express");
// Require EJS - our templating system for views.
var ejs = require("ejs");
ejs.open = "<?";
ejs.close = "?>"; // Use javascript in view files with <? ... ?>
// Express can be used under the `app` namespace.
var app = express();
// Use static files in the "/public" directory.
app.use(express.static(path.join(__dirname, "public")));
// Just some view stuff
app.set("views", path.join(__dirname, "views")); // Set views directory to "/views"
app.set("view engine", "ejs"); // Use EJS as our templating system.
// Initialize the server using node...
var server = app.listen(3000, function() {
console.log("Your blog is now running on port %d...", server.address().port);
});
// Fire up the server when this file is executed.
module.exports = server;
{
"name": "NodexBook",
"description": "My snazzy new blog built with Node, Express and Bookshelf.",
"dependencies": {
"express": "4.6.1",
"ejs": "1.0.0",
"strftime": "0.8.1",
"knex": "0.6.22",
"bookshelf": "0.7.7",
"sqlite3": "2.2.4"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment