This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var testHelpers = require('./testHelpers.js'); | |
var co = require('co'); | |
var app = require('../app.js'); | |
var request = require('supertest').agent(app.listen()); | |
describe('Adding questions', function(){ | |
var NEW_QUESTION_URL = '/question/new'; | |
it('has a page to add new questions', function(done){ | |
request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoProdUri = process.env.MONGOHQ_URL || 'localhost:27017/koaVote_Prod'; | |
var adminUser = { | |
name : process.env.BASIC_USER || 'marcus', | |
pass : process.env.BASIC_PASS || 'koavote' | |
}; | |
var config = { | |
local: { | |
mode: 'local', | |
port: 3000, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var koa = require('koa'); | |
var mount = require('koa-mount'); | |
var auth = require('koa-basic-auth'); | |
var userAuth = require('./lib/authentication.js'); | |
var app = module.exports = koa(); | |
// Security | |
app.use(userAuth.reqBasic); | |
app.use(mount('/results', auth(userAuth.user))); | |
app.use(mount('/question', auth(userAuth.user))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var koa = require('koa'); | |
var auth = require('koa-basic-auth'); | |
var userAuth = require('./lib/authentication.js'); | |
var app = module.exports = koa(); | |
// Security | |
app.use(userAuth.reqBasic); | |
app.use(auth(userAuth.user)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var auth = require('koa-basic-auth'); | |
var koa = require('koa'); | |
var app = koa(); | |
// custom 401 handling | |
app.use(function *(next){ | |
try { | |
yield next; | |
} catch (err) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Option Base 1 | |
Public Const EMPTY_STRING As String = "" | |
Sub Button2_Click() | |
' Get week from user | |
Dim week As String | |
week = "W" & InputBox("Enter week number") | |
' Get column to paste to from user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoDevUri = process.env.MONGOHQ_URL || "localhost:27017/koaVote_Dev"; | |
var mongoStageUri = process.env.MONGOHQ_URL || "localhost:27017/koaVote_Test"; | |
var mongoProdUri = process.env.MONGOHQ_URL || "localhost:27017/koaVote_Prod"; | |
var config = { | |
local: { | |
mode: 'local', | |
port: 3000, | |
mongoUrl: mongoDevUri | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var co = require('co'); | |
var monk = require('monk'); | |
var should = require('should'); | |
var wrap = require('co-monk'); | |
var db = monk('localhost/testers'); | |
var users = wrap(db.get('users')); | |
co(function *(){ | |
yield users.remove({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var monk = require('monk'); | |
var wrap = require('co-monk'); | |
var db = monk('localhost/test'); | |
var users = wrap(db.get('users')); | |
yield users.remove({}); | |
yield users.insert({ name: 'Tobi', species: 'ferret' }); | |
yield users.insert({ name: 'Loki', species: 'ferret' }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var koa = require('koa'); | |
var onFinished = require('finished'); | |
var fs = require('fs'); | |
var app = module.exports = koa(); | |
var path = require('path'); | |
var extname = path.extname; | |
// try GET /app.js | |
app.use(function *(){ |