Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated steve's index.js

  • Loading branch information...
commit 5ac763c008a52d6df77fd8d80cbad5793d2432a8 1 parent c7344cf
@coolaj86 authored
Showing with 29 additions and 24 deletions.
  1. +29 −24 lib/index.js
View
53 lib/index.js
@@ -1,36 +1,41 @@
+/*jshint strict:true node:true es5:true onevar:true laxcomma:true laxbreak:true*/
+/*
+ * SERVER
+ */
(function () {
"use strict";
- var stack = require('./lib/stack')
+ require('http-json')(require('http'));
+
+ var connect = require('connect')
+ , cookielessSession = require('connect-cookieless-session')
+ , pathname = require('connect-pathname')
, gcf = require('express-chromeframe')
- , addSendJson = require('./lib/steve-res-json')
- , corsSession = require('./lib/connect-cors-session')
, nowww = require('nowww')
- , pathname = require('./lib/connect-pathname')
, xcors = require('connect-xcors')
- , cors
- , session
- , connect
+ , cors = xcors()
+ , session = cookielessSession()
+ , app = connect()
;
+ connect.router = require('connect_router');
+ connect.corsPolicy = cors.config;
- connect = stack.create(
- addSendJson()
- );
-
- cors = xcors();
- session = corsSession();
- connect.addMiddleware(
- nowww()
- , connect.query()
- , pathname()
- , cors
- , session
- , gcf()
- );
-
- // TODO push into middleware layer
cors.config.headers = cors.config.headers.concat(session.headers.slice());
- module.exports = connect;
+ app
+ .use(nowww())
+ .use(gcf())
+ .use(pathname())
+ .use(connect.query())
+ .use(connect.json())
+ .use(connect.urlencoded())
+ .use(cors)
+ .use(session)
+ .use(connect.favicon())
+ .use(connect.static(__dirname + '/../public'))
+ .use(connect.static(__dirname + '/../var/public'))
+ ;
+
+ module.exports = app;
}());

0 comments on commit 5ac763c

Please sign in to comment.
Something went wrong with that request. Please try again.