Permalink
Browse files

added node and express boilerplate code

  • Loading branch information...
1 parent 5aa2f21 commit 39e2f0eb70a4e578455360ee812b230ddcf9f24c @swbiggart committed Dec 29, 2011
View
@@ -0,0 +1,4 @@
+node_modules
+.monitor
+.DS_Store
+
View
@@ -1,8 +1,8 @@
## RequireJS and BackboneJS Starter
-This application is a starting point to design a modular application using RequireJS, and BackboneJS.
-
-The build.bat file in the js directory also has scripts to run to build the application with either NodeJS, or Java.
+This application is a starting point to design a modular application using Node, Express, RequireJS, and BackboneJS.
There are simple examples of how to write a router, view, and model.
-Feel free to fork and use in your own BackboneJS app!
+Feel free to fork and use in your own BackboneJS app!
+
+Thanks to jcreamer898 for the RequireJS and Backbone starter.
View
39 app.js
@@ -0,0 +1,39 @@
+
+/**
+ * Module dependencies.
+ */
+
+var express = require('express')
+ , routes = require('./routes')
+
+var app = module.exports = express.createServer();
+
+// Configuration
+
+app.configure(function(){
+ app.set('views', __dirname + '/views');
+ app.set('view engine', 'jade');
+ app.set('view options', { pretty: true });
+ app.use(express.bodyParser());
+ app.use(express.methodOverride());
+ app.use(app.router);
+ app.use(express.static(__dirname + '/public'));
+});
+
+app.configure('development', function(){
+ app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
+});
+
+app.configure('production', function(){
+ app.use(express.errorHandler());
+});
+
+// Routes
+
+app.get('/', routes.index);
+
+var port = process.env.PORT || 3000;
+app.listen(port, function() {
+ console.log("Listening on " + port);
+});
+console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
View
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>RequireJS Backbone App</title>
- <script data-main="js/main" src="js/require-jquery.js"></script>
-</head>
-<body>
- <div id="main"></div>
-</body>
-</html>
View
@@ -0,0 +1,9 @@
+{
+ "name": "application_name"
+ , "version": "0.0.1"
+ , "private": true
+ , "dependencies": {
+ "express": "2.5.2"
+ , "jade": ">= 0.0.1"
+ }
+}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
@@ -0,0 +1,8 @@
+
+/*
+ * GET home page.
+ */
+
+exports.index = function(req, res){
+ res.render('index', { title: 'Express' });
+};
View
@@ -0,0 +1 @@
+h1 Hello World
View
@@ -0,0 +1,8 @@
+!!! 5
+html(lang="en")
+ head
+ title= title
+ link(rel="stylesheet", type="text/css", href="/stylesheets/style.css")
+ script(type="text/javascript", data-main="javascripts/main", charset="utf-8", src="/javascripts/require-jquery.js")
+
+ body!= body

0 comments on commit 39e2f0e

Please sign in to comment.