Questions tagged [koa]

Koa is a web framework which aims to be a smaller, more expressive, and more robust foundation for web applications and APIs.

Koa is a web framework for Node.js, designed by the team behind Express, aiming to be a smaller, more expressive, and more robust foundation for web applications and APIs.

Use this tag if your question is about the application middleware generators and its cascading properties or the use of App.Settings. Note also the existence of the tag if you're using the middleware API with async/await.

Resources

1232 questions
0
votes
1 answer

Koa.js request with promises is hanging

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.defer(); …
BFree
  • 102,548
  • 21
  • 159
  • 201
0
votes
1 answer

Why is Webstorm showing an impossible result?

Can anyone make sense of this apparent contradiction? Please look at the following screen shot. The debugger shows the correct error object but the roll over shows the parameter to be null. The latter appears to be the actual state because no error…
Ian Warburton
  • 15,170
  • 23
  • 107
  • 189
0
votes
1 answer

Handlebars NodeJS/Koa Script/Src Reference

The answer is probably going to make me bang my head on the keyboard, but for the life of me I can't seem to figure out how to reference a template file so that I can load it from a handlebars view. Let's say the view is…
aamirl
  • 1,420
  • 2
  • 12
  • 18
0
votes
2 answers

Koa-locals not working

I have this in app.js... var koa = require('koa'); var locals = require('koa-locals'); var jade = require('koa-jade'); var app = koa(); locals(app, { moment: require('moment'), _: require('lodash') }); …
Ian Warburton
  • 15,170
  • 23
  • 107
  • 189
0
votes
1 answer

Yield a mongoose result from a loop in Koa.js

I'm using Koa.js with Mongoose.js. There is a collection in my mongo named css. Which have following schema: _id css_name css_value I have an array containing a huge list like: var list = ['font-color', 'back-color', 'font-family', 'back-image',…
Mazhar Ahmed
  • 1,523
  • 2
  • 24
  • 41
0
votes
1 answer

Socket.io with koa

I'm working on an iOS App with an socket.io/koa (https://github.com/koajs/koa) service connection. For testing the service I'm using thor (https://github.com/observing/thor). The problem is, that my socket.io service wont return anything. When I…
teawithfruit
  • 767
  • 1
  • 11
  • 22
0
votes
1 answer

node 0.11.13 gives an error for generator syntax

Node version 0.11.13 gives out an error: How it can be solved? PS the code is a simple example: var koa = require('koa'); var app = koa(); app.use(function *(){ this.body = 'Hello World'; }); app.listen(3000);
Nik Terentyev
  • 2,270
  • 3
  • 16
  • 23
0
votes
2 answers

How to initialize a koa node.js app application on IISNode (Azure WebSites)

We are currently moving a self-hosted koa app to IISNode on Azure WebSites.. In self-hosting, we initiallize the application by calling node --harmony ./bin/application Requests then go to ./index.js. However we could not find how to setup…
JoaoCC
  • 624
  • 6
  • 15
0
votes
1 answer

KoaJS: how to send partial responses?

I'm learning KOA and Node.JS streams. What I'm trying to do is sending a partial HTTP response, and after a short while send the rest of the response. app.get("/", function*(next) { // TEST: function delay(ms) { return function(callback) { …
Udo G
  • 12,572
  • 13
  • 56
  • 89
0
votes
4 answers

Koa and Passport with MongoDb

I'm having some troubles with Koa, Passport and Monk. I'd like to have a simple local authentication with Passport. I've followed some tutorials and got as far as this: (auth.js) const passport = require('koa-passport'), LocalStrategy =…
QlliOlli
  • 637
  • 3
  • 13
  • 25
0
votes
1 answer

How to turn non-idiomatc nodejs callback into thunk?

I'm using the Firebase node module and trying to convert it's callbacks to thunks to be able to use them in Koa. This is the original event listener callback as per the Firebase documentation: projects.on('value', function (snapshot) { …
Alfred
  • 7,071
  • 4
  • 27
  • 35
0
votes
1 answer

Using Model method waterline

I'm starting with koa and waterline ORM. I have a problem when I try to use "testFucntion" method from this waterline model from my controller: "use strict"; //https://github.com/balderdashy/waterline-docs var Waterline = require('waterline'); var…
0
votes
1 answer

Node js unsupported content-type application/octet-stream

I'm using koajs. I'm using https://github.com/mscdex/busboy to parse the file multipart. It's working perfectly when i'm using normal multipart form upload. But recently I'm trying to upload file using ajax uploader. Whenever I drop my files to the…
nixon1333
  • 531
  • 1
  • 9
  • 23
0
votes
1 answer

Node.js harmony: How to yield elasticsearch.js calls (using koa)

After an hour of trying various syntaxes and npm modules: How would I achieve yielding a call to the elasticsearch client? I'm looking at something like this: var res = yield *client.get({ index: index, type: type, id: id, ignore:…
Gnimmelf
  • 137
  • 2
  • 9
0
votes
1 answer

Koa and Twitter - "Thunking" does not work

I've gotten some third party asynchronous functions to work with Koa through thunking, either by wrapping the function like so: var thunkedFunction = function(params) { return function(callback) { originalFunction(params, callback) }; ) or using the…
arilaan
  • 384
  • 2
  • 17