-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented lass, Updated deps, Fixed tests, Fixed README
- Loading branch information
1 parent
e79032f
commit 3b3a47a
Showing
17 changed files
with
3,924 additions
and
952 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
{ | ||
"presets": [ "crocodile" ], | ||
"plugins": [ | ||
"transform-runtime", | ||
"add-module-exports" | ||
"presets": [ | ||
["env", { | ||
"targets": { | ||
"node": "6.4.0" | ||
} | ||
}] | ||
], | ||
"sourceMaps": "inline" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
lib | ||
coverage | ||
lib |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,7 @@ | ||
|
||
# osx | ||
.DS_Store | ||
|
||
# project | ||
node_modules/ | ||
logs | ||
*.log | ||
npm-debug.log* | ||
*.idea | ||
coverage/ | ||
.idea | ||
node_modules | ||
coverage | ||
.nyc_output | ||
lib | ||
package-lock.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
language: node_js | ||
node_js: | ||
- '6' | ||
- '7' | ||
- '8' | ||
after_success: | ||
npm run coverage |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,31 @@ | ||
const Koa = require('koa'); | ||
const Router = require('koa-router'); | ||
const koa404Handler = require('koa-404-handler'); | ||
|
||
import errorHandler from '../'; | ||
import Koa from 'koa'; | ||
import Router from 'koa-router'; | ||
const errorHandler = require('../'); | ||
|
||
// initialize our app | ||
const app = new Koa(); | ||
|
||
// override koa's undocumented error handler | ||
app.context.onerror = errorHandler; | ||
|
||
// specify that this is our api | ||
app.context.api = true; | ||
|
||
// set up some routes | ||
const router = new Router(); | ||
|
||
// throw an error anywhere you want! | ||
router.get('/404', ctx => ctx.throw(404)); | ||
router.get('/500', ctx => ctx.throw(500)); | ||
|
||
// custom 404 handler since it's not already built in | ||
app.use(async (ctx, next) => { | ||
try { | ||
await next(); | ||
if (ctx.status === 404) | ||
ctx.throw(404); | ||
} catch (err) { | ||
ctx.throw(err); | ||
ctx.app.emit('error', err, ctx); | ||
} | ||
}); | ||
|
||
// initialize routes on the app | ||
app.use(router.routes()); | ||
|
||
// use koa-404-handler | ||
app.use(koa404Handler); | ||
|
||
// start the server | ||
app.listen(3000); | ||
console.log('listening on 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
Oops, something went wrong.