Permalink
Browse files

Latest production

  • Loading branch information...
1 parent 5b4ae7b commit cd88451658bf09cac1aed4c8d99b6b812470ae8d @ggoodman ggoodman committed Feb 13, 2015
Showing with 82 additions and 46 deletions.
  1. +24 −1 index.coffee → app.coffee
  2. +35 −0 index.js
  3. +16 −14 package.json
  4. +7 −31 server.js
@@ -49,6 +49,7 @@ markdown = require("marked")
stylus = require("stylus")
nib = require("nib")
traceur = require("traceur")
+to5 = require("6to5")
TRACEUR_RUNTIME = ""
@@ -94,7 +95,8 @@ compilers =
.import("nib")
.render(fn)
catch err
- fn(err)
+ fn(err)
+
coffeescript:
match: /\.js$/
ext: ['coffee']
@@ -115,6 +117,27 @@ compilers =
fn null, js, smap
catch err
fn(err)
+
+ to5:
+ match: /\.js$/
+ ext: ['6to5.js']
+ compile: (path, filename, source, str, plunk, fn) ->
+ try
+ result = to5.transform str,
+ filename: filename
+ experimental: true
+ modules: "umd"
+ sourceMap: "inline"
+ sourceMapName: source
+ sourceFileName: source
+ sourceRoot: path
+
+ fn null, result.code, result.map
+ catch err
+ console.error("Error", err)
+
+ fn(err)
+
traceur:
match: /\.js$/
View
@@ -0,0 +1,35 @@
+require("coffee-script");
+
+//process.env.NODE_ENV = "production";
+
+var nconf = require("nconf")
+ , http = require("http")
+ , server = require("./app")
+ , domain = require("domain")
+ , serverDomain = domain.create();
+
+
+serverDomain.run(function(){
+ http.createServer(function(req, res){
+ var reqd = domain.create();
+ reqd.add(req);
+ reqd.add(res);
+
+ // On error dispose of the domain
+ reqd.on('error', function (error) {
+ console.error('[ERR]', error.code, error.message, req.url);
+ reqd.dispose();
+ });
+
+ // Pass the request to express
+ server(req, res);
+
+ }).listen(nconf.get("PORT"), function(){
+ console.log("[OK] Server started");
+ });
+
+});
+
+serverDomain.on("error", function (error) {
+ console.trace('[ERR]', "Server level error", error.code, error.message);
+});
View
@@ -13,29 +13,31 @@
"version": "0.3.21",
"private": true,
"dependencies": {
+ "6to5": "^2.9.3",
+ "LiveScript": "*",
"coffee-script": "1.6.x",
"express": "3.x",
+ "forever-monitor": "^1.2.3",
+ "genid": "0.1.x",
"gzippo": "0.1.x",
- "mime": "*",
- "underscore": "1.3.x",
- "nconf": "0.5.x",
+ "jade": "*",
"json-schema": "https://github.com/kriszyp/json-schema/tarball/master",
- "lru-cache": "1.1.x",
- "request": "2.x",
+ "lactate": "~0.13.12",
"less": "*",
- "jade": "*",
+ "lru-cache": "1.1.x",
"marked": "*",
- "LiveScript": "*",
- "stylus": "*",
+ "mime": "*",
+ "nconf": "0.5.x",
"nib": "*",
- "typescript-wrapper": "*",
- "uglify-js": "2.3.x",
"node-ga": "0.1.x",
- "genid": "0.1.x",
- "lactate": "~0.13.12",
- "sass": "~0.5.0",
"node-sass": "~0.6.7",
- "traceur": "0.0.10"
+ "request": "2.x",
+ "sass": "~0.5.0",
+ "stylus": "*",
+ "traceur": "0.0.10",
+ "typescript-wrapper": "*",
+ "uglify-js": "2.3.x",
+ "underscore": "1.3.x"
},
"bundledDependencies": [
"json-schema"
View
@@ -1,35 +1,11 @@
-require("coffee-script");
+var forever = require('forever-monitor');
-//process.env.NODE_ENV = "production";
-
-var nconf = require("nconf")
- , http = require("http")
- , server = require("./index")
- , domain = require("domain")
- , serverDomain = domain.create();
-
-
-serverDomain.run(function(){
- http.createServer(function(req, res){
- var reqd = domain.create();
- reqd.add(req);
- reqd.add(res);
-
- // On error dispose of the domain
- reqd.on('error', function (error) {
- console.error('[ERR]', error.code, error.message, req.url);
- reqd.dispose();
- });
+var child = new (forever.Monitor)('index.js', {
+ max: 10,
+});
- // Pass the request to express
- server(req, res);
-
- }).listen(nconf.get("PORT"), function(){
- console.log("[OK] Server started");
- });
-
+child.on('exit', function () {
+ console.log('[ERR] App killed after 10 fails.');
});
-serverDomain.on("error", function (error) {
- console.trace('[ERR]', "Server level error", error.code, error.message);
-});
+child.start();

0 comments on commit cd88451

Please sign in to comment.