Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added node and express boilerplate code

  • Loading branch information...
commit 39e2f0eb70a4e578455360ee812b230ddcf9f24c 1 parent 5aa2f21
Scott Woolsey Biggart authored
4 .gitignore
View
@@ -0,0 +1,4 @@
+node_modules
+.monitor
+.DS_Store
+
8 README.md
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.
39 app.js
View
@@ -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);
10 index.htm
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>
9 package.json
View
@@ -0,0 +1,9 @@
+{
+ "name": "application_name"
+ , "version": "0.0.1"
+ , "private": true
+ , "dependencies": {
+ "express": "2.5.2"
+ , "jade": ">= 0.0.1"
+ }
+}
0  js/app.build.js → public/javascripts/app.build.js
View
File renamed without changes
0  js/app.js → public/javascripts/app.js
View
File renamed without changes
0  js/libs/backbone-localstorage.js → public/javascripts/libs/backbone-localstorage.js
View
File renamed without changes
0  js/libs/backbone.js → public/javascripts/libs/backbone.js
View
File renamed without changes
0  js/libs/modernizr-latest.js → public/javascripts/libs/modernizr-latest.js
View
File renamed without changes
0  js/libs/underscore-min.js → public/javascripts/libs/underscore-min.js
View
File renamed without changes
0  js/libs/underscore.js → public/javascripts/libs/underscore.js
View
File renamed without changes
0  js/main.js → public/javascripts/main.js
View
File renamed without changes
0  js/models/model.js → public/javascripts/models/model.js
View
File renamed without changes
0  js/order.js → public/javascripts/order.js
View
File renamed without changes
0  js/require-jquery.js → public/javascripts/require-jquery.js
View
File renamed without changes
0  js/routers/home.js → public/javascripts/routers/home.js
View
File renamed without changes
0  js/templates/main.html → public/javascripts/templates/main.html
View
File renamed without changes
0  js/text.js → public/javascripts/text.js
View
File renamed without changes
0  js/views/view.js → public/javascripts/views/view.js
View
File renamed without changes
8 routes/index.js
View
@@ -0,0 +1,8 @@
+
+/*
+ * GET home page.
+ */
+
+exports.index = function(req, res){
+ res.render('index', { title: 'Express' });
+};
1  views/index.jade
View
@@ -0,0 +1 @@
+h1 Hello World
8 views/layout.jade
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
Please sign in to comment.
Something went wrong with that request. Please try again.