Problem  I am trying to run simple http server using koa2, but have problems running it.  It uses es6 that is expected to work in future node.js versions and I was wondering how can I run it with node v6.1.0 ?  Code    import Koa from 'koa';...
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...
I'm using knex transaction with async/await syntax as suggested in this question: Get Knex.js transactions working with ES7 async/await  My problem is, that when transaction fails and trx callback is invoked, knex logs     Unhandled rejection err...
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'm trying to use co-mocha to test some nested generators functionality in my koa app.  The class works just fine at runtime, but when I attempt to test the functionality, I cannot get the nested generator to run in my test.  Class being tested:...
I'm trying to require an external library in my Node app (Koa server). I'm adding njwt in my main server.js file var njwt = require('njwt');  But I can't access njwt, in my route handler function it gives an error saying njwt is u...
I am trying to use model.create and it's saying that model.create is not a function. I googled around and couldn't seem to find any rmesolutions. Please note that I'm using es6 imports / exports in node via babel.   model.js  'use str...
So I'm messing around with Koa.js and generators, just threw together a simple site for demo purposes. I'm using sqlite with node-sqlite3 and Q for promises. Here's my db code:  module.exports.getLogs = function(){     var deferred = Q.de...
Because I spent some (too much) time figuring out this simple requirement. I am documenting here the way to achieve multipart/form-data body parsing with Koa.  In my case, the reason of the confusion was the number of alternatives available out there...
What I want to do is serve the index.html file when the index route (i.e. localhost:3000) is called.  I use koa-router for routing, so my route looks like this:  app.all("/", function * (next){     //Send the file here });   I tried to use ko...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.