I'm currently trying to spawn a child process to handle some POST data with NodeJS (using Koa framework).  Ideally, I would like to wait for the child process to finish before redirecting, but since the child process is asynchronous, the code alw...
To optimize the response delay, it is necessary to perform work after are response has been sent back to the client. However, the only way I can seem to get code to run after the response is sent is by using setTimeout. Is there a better way? Perhaps...
I have a 404.jade file that I want to render whenever there is an invalid GET request.  Here is my current code:  app.js  import Koa from 'koa' import views from 'koa-views' import serve from 'koa-static' import rootRoutes fro...
I try to get an information from a redis db and return it as the body of the response to the user. First, here is a code that fails :  var redis = require("redis"),     koa = require("koa");  var app = koa(),     port = process.argv[2...
How can I extend third-party declaration files? for example, I want to extend Context from @types/koa and add an extra field(resource) to it. I tried this:  // global.d.ts declare namespace koa {     interface Context {         resource: any;     } }...
I have a Koa app I just started and I need to test something that grabs data from a config file.  I need to test with specific data, but I'm not sure how to modify what data the test receives from the config file.  Example:  app.js  var router =...
var app = require('koa')(); var router = require('koa-router');  app.use(router(app));   Throws this error:     AssertionError: app.use() requires a generator function   A lot of sample code says to setup koa-router this way. It suppo...
I have a simple Koa app. I also use mongoose, mongodb(Mlab)  I connected to mongodb. And I can find only ourCat. I see array in console. But I don't know, how I can get and show result on page. And how I can use my request to db in some middlewar...
Since iojs merged into Node. I assumed I can run koajs without the --harmony tag (because it'll have generators from es6 supported).  So within my server.js file I have:  var koa = require('koa'); var app = koa();  app.use(function *(){...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.