Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var koa = require('koa');
- var router = require('koa-router');
- var app = koa();
- var thunkify = require('thunkify');
- app.use(router(app));
- //Calback function
- function load(callback){
- result = 'Hello';
- //Do something with xmla4js and ajax
- callback(null, result);
- }
- load = thunkify(load);
- function *loadJson(){
- var that = this;
- var result = yield load();
- that.status = 200;
- that.body = result;
- }
- app.get('/load',loadJson);
- app.listen(3000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement