0.0.1 • Published 8 years ago
saba v0.0.1
Sāba
Install
$ npm install --save saba
Usage
const {saba, send} = require('saba')
const app = saba((req, res) => {
if (req.url === '/404') {
return sned(res, 'not found', 404)
}
send(res, 'hello world')
})
app.listen(3000)
Handle Error
const handleError = fn => {
return async (req, res) => {
try {
await fn(req, res)
} catch (err) {
// perform your logic here...
console.log(err.stack)
}
}
}
saba(handleError(async (req, res) => {
send(res, 'ready')
}))
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
License
0.0.1
8 years ago