Browse Source

get to doc

pull/34/head
Harish Krishna 10 years ago
parent
commit
81b3668b30
  1. 8
      app.js
  2. 0
      controller/doc.js
  3. 0
      sanitiser/doc.js
  4. 4
      test/ciao/doc/msuccess.coffee
  5. 4
      test/ciao/doc/success.coffee
  6. 2
      test/unit/run.js
  7. 8
      test/unit/sanitiser/doc.js

8
app.js

@ -11,7 +11,7 @@ app.use( require('./middleware/jsonp') );
/** ----------------------- sanitisers ----------------------- **/
var sanitisers = {};
sanitisers.get = require('./sanitiser/get');
sanitisers.doc = require('./sanitiser/doc');
sanitisers.suggest = require('./sanitiser/suggest');
sanitisers.search = sanitisers.suggest;
sanitisers.reverse = require('./sanitiser/reverse');
@ -20,7 +20,7 @@ sanitisers.reverse = require('./sanitiser/reverse');
var controllers = {};
controllers.index = require('./controller/index');
controllers.get = require('./controller/get');
controllers.doc = require('./controller/doc');
controllers.suggest = require('./controller/suggest');
controllers.search = require('./controller/search');
@ -29,8 +29,8 @@ controllers.search = require('./controller/search');
// api root
app.get( '/', controllers.index() );
// get doc API
app.get( '/get', sanitisers.get.middleware, controllers.get() );
// doc API
app.get( '/doc', sanitisers.doc.middleware, controllers.doc() );
// suggest API
app.get( '/suggest', sanitisers.suggest.middleware, controllers.suggest() );

0
controller/get.js → controller/doc.js

0
sanitiser/get.js → sanitiser/doc.js

4
test/ciao/get/mget.coffee → test/ciao/doc/msuccess.coffee

@ -1,6 +1,6 @@
#> valid get query
path: '/get?id=geoname:4221195&id=geoname:4193595'
#> valid doc query
path: '/doc?id=geoname:4221195&id=geoname:4193595'
#? 200 ok
response.statusCode.should.equal 200

4
test/ciao/get/success.coffee → test/ciao/doc/success.coffee

@ -1,6 +1,6 @@
#> valid get query
path: '/get?id=geoname:4221195'
#> valid doc query
path: '/doc?id=geoname:4221195'
#? 200 ok
response.statusCode.should.equal 200

2
test/unit/run.js

@ -7,7 +7,7 @@ var tests = [
require('./controller/suggest'),
require('./controller/search'),
require('./sanitiser/suggest'),
require('./sanitiser/get'),
require('./sanitiser/doc'),
require('./query/indeces'),
require('./query/suggest'),
require('./query/search'),

8
test/unit/sanitiser/get.js → test/unit/sanitiser/doc.js

@ -1,7 +1,7 @@
var get = require('../../../sanitiser/get'),
_sanitize = get.sanitize,
middleware = get.middleware,
var doc = require('../../../sanitiser/doc'),
_sanitize = doc.sanitize,
middleware = doc.middleware,
indeces = require('../../../query/indeces'),
delimiter = ':',
defaultLengthError = function(input) { return 'invalid param \''+ input + '\': text length, must be >0' },
@ -150,7 +150,7 @@ module.exports.tests.middleware_success = function(test, common) {
module.exports.all = function (tape, common) {
function test(name, testFunction) {
return tape('SANTIZE /get ' + name, testFunction);
return tape('SANTIZE /doc ' + name, testFunction);
}
for( var testCase in module.exports.tests ){
Loading…
Cancel
Save