Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 05 16:26
    fengmk2 closed #1694
  • Oct 05 16:18

    fengmk2 on master

    docs: Remove outdated links fro… (compare)

  • Oct 04 16:16

    dependabot[bot] on master

    build(deps-dev): bump supertest… (compare)

  • Oct 04 16:16

    dependabot[bot] on npm_and_yarn

    (compare)

  • Oct 04 16:16
    dependabot[bot] closed #1695
  • Oct 04 16:16
    jongleberry-bot commented #1695
  • Oct 04 15:25
    codecov[bot] commented #1695
  • Oct 04 15:23

    dependabot[bot] on npm_and_yarn

    build(deps-dev): bump supertest… (compare)

  • Oct 04 15:23
    dependabot[bot] labeled #1695
  • Oct 04 15:23
    dependabot[bot] opened #1695
  • Oct 04 05:55
    codecov[bot] commented #1694
  • Oct 04 05:52
    sgpinkus opened #1694
  • Oct 03 16:36
    mylastore commented #1532
  • Oct 03 16:33
    mylastore commented #1532
  • Sep 30 15:31

    dependabot[bot] on npm_and_yarn

    build(deps-dev): bump jest from… (compare)

  • Sep 30 15:31

    dependabot[bot] on npm_and_yarn

    (compare)

  • Sep 30 15:31
    dependabot[bot] closed #1692
  • Sep 30 15:31
    dependabot[bot] commented #1692
  • Sep 30 15:31
    dependabot[bot] labeled #1693
  • Sep 30 15:31
    dependabot[bot] opened #1693
Naguib Ihab (A.K.A. Nick)
@naguibIhab_twitter
delphi
@johndeguerto
is it possible to access the koa.context.object inside a passportjs plementation?
Muhammad Habib
@habibsatti_twitter
hi
Saad Quadri
@saadq
hey :D
Marco Carvalho
@mcarvalho21
hi all
Marco Carvalho
@mcarvalho21
anyone alive?
Saad Quadri
@saadq
whats up
delphi
@johndeguerto
koa is the so easy to use, I prefer it over express
reason this channel isn’t as active as express is because of it’s simplistic design and therefore not everyone requires help
delphi
@johndeguerto
Btw guys here is a slocket cluster koa base application with koa router. https://github.com/johndeguerto/SocketCluster-koa
Now you can run koa with all cpu power and all of socket cluster features
David Ojimba
@davidkayce_gitlab
hello everyone, nice to be here
I am a newbie to koa and I am trying to use it for an app using mongoose
let post_promise = Post.findOne({ title: 'First post' }).exec()
  await post_promise.then((result) => {
    console.log(result)
    ctx.body = result
    ctx.status = 200
  }).catch((err) => {
    console.log(err)
  })
  console.log('Gotten here')
This keeps returning a 404 not found error
but it does find the post , and it logs the right post to the console
please help anyone?
Jeff Hansen
@jeffijoe
Seems like a promise-related issue, not Koa
David Ojimba
@davidkayce_gitlab
so its a mongoose problem?
Jeff Hansen
@jeffijoe
I don't use Mongoose so I don't know what Promise impl it uses
David Ojimba
@davidkayce_gitlab
oh okay thanks
delphi
@johndeguerto
Do you still need help with this?
David Ojimba
@davidkayce_gitlab
yes, please I do, still havent been able to find a way to resolve it
Samuel Grave
@itsmegrave
hey guys! Do anyone have a list of "must-have" packages for a koa api?
Saad Quadri
@saadq
It really depends on your needs for your api, but at a minimum I would recommend having koa-helmet
Mike Hamilton
@gorbypark
hey guys, noob question here, but can anyone tell me why the body is only [1,2] and not [1,2,3]? I thought middleware flows down, then back up, then the response is sent?
app.use(async (ctx, next) => {
  arr.push(1);
  await next();
  arr.push(3);
});

app.use(async (ctx, next) => {
  arr.push(2);
  await next();
});

app.use(async ctx => {
  ctx.body = JSON.stringify(arr);
});
Jame
@jamemackson
the body is set on the response before 3 is added to the array. everything after a next is happening on the way back up the middleware stack.
Mike Hamilton
@gorbypark
ah, so it goes down, does the response, then goes up
Casey Britt
@yourfavorite

Anyone able to help me better understand a Middleware pattern? I'm wondering if there is an article or tutorial out there about how to add Middlewares to your own code rather than writing Middlewares for existing packages. Or even just one that breaksdown how Middlewares work in something like Koa. Searching google just gets me info on how to write better middelwares for things like Koa/Express.

I'm particularly interested in the pattern Koa uses with context and would love an article that pulls the general flow out into some easier to comprehend code as jumping through the many koa packages is difficult for me to follow.

Jame
@jamemackson
@yourfavorite i would start with https://koajs.com where they give some simple example of middleware in koa
the docs there are pretty simple and that’s simply because koa is pretty simple in what it does.
the one thing to note is that koa calls middleware down and then back up when a await next(); is called. so anything after the next call is happening on the way back up.
Casey Britt
@yourfavorite
@jamemackson I don't quite follow the way down and way back up. Are you saying that Koa goes mw1 -> next() -> mw2 -> await next() -> mw3 -> next() -> mw2 -> ??
Jame
@jamemackson
yes. next passes control down the middleware stack until something sets a response and the flow goes back up executing any code that follows the next call. see the example above that mike posted a day or two ago.
Casey Britt
@yourfavorite
Oh I see
So basically
ctx.before = true;
await next();
// Go do other middlewares...
ctx.after = true;
Jame
@jamemackson
yup. that’s about it.
Casey Britt
@yourfavorite
What is a practical reason for wanting to do this?
Jame
@jamemackson
there are times you want to do something with a response going out. maybe time a response or validate some data
Jackie Gleason
@jrgleason
Can someone help me with koa-jwt. I have it configured but for some reason it is still throwing a 401 even after I am signed in.
Ghost
@ghost~5ac084b8d73408ce4f93eee9
Anyone know how i can modify a specific visitor sessions outside the scope of koa (ctx) ? Getting certain info from Jayson TCP sockets that i want to apply to the correct users session.
Kirk Gordon
@krg7880
Does Koa support keep-alive by default? If not, how can one enable it?
Nicholas
@NicholasCao
Here is a new project. https://github.com/goa-go/goa just like koa for golang, I'm looking for someone to join us.
Eyal Perry
@EyalPerry
@NicholasCao I love the name :D and I do love koa. Unfortunately I do not know go at all
Nicholas
@NicholasCao
@EyalPerry
It doesn't matter, thank you for your start
Aaron
@4aron
Hi
Wow no chat since 1 month...
Can I add an extra arguments to session.save with koa-session?