// server.js
//
// main function for activity pump application
//
// Copyright 2011, StatusNet Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

var connect = require('connect'),
    bcrypt  = require('bcrypt'),
    ActivityPump = require('./lib/activitypump').ActivityPump,
    server = connect.createServer(
        connect.logger(),
        connect.bodyParser(),
        connect.static(__dirname + '/public'),
        connect.errorHandler({showStack: true, dumpExceptions: true}),
        connect.query(),
        connect.router(ActivityPump.initApp)
    ),
    port = process.env.PORT || 8001,
    hostname = process.env.HOSTNAME || 'localhost',
    databank = require('databank'),
    config = require('./config'),
    params,
    Databank = databank.Databank,
    DatabankObject = databank.DatabankObject,
    db;

params = config.params;
params.schema = ActivityPump.getSchema();
db = Databank.get(config.driver, params);

// Connect...

db.connect({}, function(err) {
    if (err) {
        console.log("Couldn't connect to JSON store: " + err.message);
    } else {

        ActivityPump.port = port;
        ActivityPump.hostname = hostname;
        ActivityPump.bank = DatabankObject.bank = db;

        // ...then listen
        server.listen(port, hostname);
    }
});

@@ -786,294 +786,8 @@
 mp,%0A
-    server = connect.createServer(%0A        connect.logger(),%0A        connect.bodyParser(),%0A        connect.static(__dirname + '/public'),%0A        connect.errorHandler(%7BshowStack: true, dumpExceptions: true%7D),%0A        connect.query(),%0A        connect.router(ActivityPump.initApp)%0A    ),%0A
     
@@ -819,16 +819,16 @@
 %7C 8001,%0A
+
     host
@@ -1108,16 +1108,17 @@
 hema();%0A
+%0A
 db = Dat
@@ -1194,24 +1194,41 @@
 tion(err) %7B%0A
+    var server;%0A%0A
     if (err)
@@ -1226,24 +1226,25 @@
  if (err) %7B%0A
+%0A
         cons
@@ -1298,24 +1298,25 @@
 r.message);%0A
+%0A
     %7D else %7B
@@ -1393,16 +1393,16 @@
 stname;%0A
-
         
@@ -1448,16 +1448,409 @@
  = db;%0A%0A
+        server = connect.createServer(%0A            connect.logger(),%0A            connect.bodyParser(),%0A            connect.static(__dirname + '/public'),%0A            connect.errorHandler(%7BshowStack: true, dumpExceptions: true%7D),%0A            connect.query(),%0A            connect.router(ActivityPump.initApp),%0A            connect.session(%7Bsecret: (config.secret %7C%7C %22activitypump%22)%7D)%0A        );%0A%0A
         

Use connect.session for session data