diff --git a/api/index.js b/api/index.js index 4a95ef1..16b09d4 100644 --- a/api/index.js +++ b/api/index.js @@ -10,5 +10,5 @@ module.exports = { }; function kickable (it) { - return it == "it" ? true : false; + return it && it.toUpperCase() == "IT" ? true : false; } \ No newline at end of file diff --git a/index.js b/index.js index b2977ec..651ec7d 100755 --- a/index.js +++ b/index.js @@ -6,10 +6,16 @@ const Koa = require('koa'); const route = require('koa-route'); -const api = require('./api') +const logger = require('koa-logger'); + +const api = require('./api'); const app = new Koa(); +const port = process.env.PORT || 3000; +app.use(logger()) app.use(route.get('/kick/:it', api.kick)); -app.listen(3000); +app.listen(port); + +console.log(`kickable now running on port ${port}`); \ No newline at end of file diff --git a/package.json b/package.json index aa80972..f6f7745 100644 --- a/package.json +++ b/package.json @@ -8,13 +8,14 @@ "test": "ava -v", "cover": "nyc npm run test", "report": "npm run codecov & npm run coveralls", - "codecov": "./node_modules/.bin/nyc report --reporter=lcov | ./node_modules/.bin/codecov -B $(date \"+%Y%m%d%H%M%S\")", + "codecov": "./node_modules/.bin/nyc report --reporter=lcov | ./node_modules/.bin/codecov -B $(date \"+%Y%m%d%H%M%S\")", "coveralls": "./node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls" }, "author": "", "license": "ISC", "dependencies": { "koa": "^2.2.0", + "koa-logger": "^2.0.1", "koa-route": "^3.2.0" }, "devDependencies": { diff --git a/test/api-test.js b/test/api-test.js index b513fa5..5979ab7 100644 --- a/test/api-test.js +++ b/test/api-test.js @@ -27,7 +27,7 @@ test("successful", (t) => { t.is(res.body, true) }); -test.skip("case sensitive", (t) => { +test("case sensitive", (t) => { const res = kick("IT") t.is(res.body, true) }); \ No newline at end of file