Skip to content

Commit

Permalink
Merge pull request WardCunningham#128 from nrn/master
Browse files Browse the repository at this point in the history
Express: Fixed bad status header
  • Loading branch information
WardCunningham committed Feb 14, 2012
2 parents f893afc + f5c5c4c commit 847fd37
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions server/express/ReadMe.md
Expand Up @@ -50,7 +50,7 @@ To get started with the second pattern checkout lib/farm.coffee as an example.
npm test
* Make sure you have Ruby 1.9.x installed, as well as the 'bundler' gem
* Run `bundle install` in the root
* Start the Express server in integration testing mode:
server/express/bin/server.js --test
* Run the integration specs against the node/express server.
TEST_NODE=true bundle exec rspec spec/integration_spec.rb
* Start the Express server in integration testing mode:
`server/express/bin/server.js --test`
* Run the integration specs against the node/express server:
`TEST_NODE=true bundle exec rspec spec/integration_spec.rb`
7 changes: 4 additions & 3 deletions server/express/lib/server.coffee
Expand Up @@ -20,13 +20,15 @@ module.exports = exports = (argv) ->
random = require('./random_id')
passportImport = require('passport')
OpenIDstrat = require('passport-openid').Strategy
# Create the main application object, app.
app = express.createServer()
# defaultargs.coffee exports a function that takes the argv object that is passed in and then does its
# best to supply sane defaults for any arguments that are missing.
argv = require('./defaultargs')(argv)
# Construct authentication handler.
passport = new passportImport.Passport()
# Tell pagehandler where to find data, and default data.
pagehandler = require('./page')(argv)
app.pagehandler = pagehandler = require('./page')(argv)

OPENID = "#{argv.status}/open_id.identity"

Expand Down Expand Up @@ -105,7 +107,6 @@ module.exports = exports = (argv) ->
next(err)

#### Express configuration ####
app = express.createServer()
# Set up all the standard express server options,
# including hbs to use handlebars/mustache templates
# saved with a .html extension, and no layout.
Expand Down Expand Up @@ -178,7 +179,7 @@ module.exports = exports = (argv) ->
info = {
pages: []
authenticated: req.isAuthenticated()
status: if owner
loginStatus: if owner
if req.isAuthenticated()
'logout'
else 'login'
Expand Down
3 changes: 1 addition & 2 deletions server/express/test/server.coffee
Expand Up @@ -4,7 +4,6 @@ random = require '../lib/random_id'
testid = random()
argv = require('../lib/defaultargs.coffee')({d: path.join('/tmp', 'sfwtests', testid), p: 55555})
fs = require('fs')
pagehandler = require('../lib/page.coffee')(argv)

describe 'server', ->
describe '#actionCB()', ->
Expand All @@ -27,7 +26,7 @@ describe 'server', ->
createSend = (test, done) ->
(str) ->
console.log str
pagehandler.get('asdf-test-page', (data) ->
runningServer.pagehandler.get('asdf-test-page', (data) ->
test(data)
done()
)
Expand Down
6 changes: 3 additions & 3 deletions server/express/views/static.html
Expand Up @@ -21,16 +21,16 @@
<div class='page' id={{page}} {{origin}}></div>
{{/pages}}
</section>
<footer class={{status}}>
<footer class={{loginStatus}}>
{{#authenticated}}
<form action='/logout' method='POST'>
<input type='submit' value={{status}}>
<input type='submit' value={{loginStatus}}>
{{/authenticated}}
{{^authenticated}}
<form action='/login' method='POST'>
OpenID:
<input name='identifier' type='text'>
<input type='submit' value={{status}}>
<input type='submit' value={{loginStatus}}>
or use:
<span class='provider'>
<input data-provider='https://www.google.com/accounts/o8/id' title='google' type='button' value='G'>
Expand Down

0 comments on commit 847fd37

Please sign in to comment.