Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 14:28
    krisstern commented #1646
  • Nov 26 19:30
    Matthewloughton closed #1713
  • Nov 26 19:30
    Matthewloughton commented #1713
  • Nov 26 19:08
    Matthewloughton commented #1713
  • Nov 26 19:05
    Matthewloughton commented #1713
  • Nov 26 18:53
    Matthewloughton opened #1713
  • Nov 26 18:53
    Matthewloughton labeled #1713
  • Nov 25 02:48
    Hyperblaster closed #1711
  • Nov 25 02:47
    Hyperblaster opened #1711
  • Nov 12 23:40
    zkulbeda edited #1710
  • Nov 12 23:37
    zkulbeda labeled #1710
  • Nov 12 23:37
    zkulbeda opened #1710
  • Nov 09 15:04

    dependabot[bot] on npm_and_yarn

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

  • Nov 09 15:04

    dependabot[bot] on npm_and_yarn

    (compare)

  • Nov 09 15:04
    dependabot[bot] closed #1708
  • Nov 09 15:04
    dependabot[bot] commented #1708
  • Nov 09 15:04
    dependabot[bot] labeled #1709
  • Nov 09 15:04
    dependabot[bot] opened #1709
  • Nov 08 15:04
    dependabot[bot] closed #1704
  • Nov 08 15:04
    dependabot[bot] commented #1704
Aaron
@4aron
But what about inside one of my middlewares?
Jeff Hansen
@jeffijoe
@gorbypark const roleAdmin => (permissions) => (ctx, next) => ...
@4aron Sure, you can set whatever you want on the context, but I think thats what ctx.state is for, see above
Jack c
@soydepr
Totally ne2 to node ane frameworks i was able to manage get and post but having issues with delete for delete do i use koa-route or koa-router delete id
How would i delete an id in router.del or router.delete
Jack c
@soydepr
Can someone clarify to me the status of koajs is it alive, discontinued? Before i emerge more would like to know as i am strulling with delete route
Mingsterism
@mingsterism
hi, how come my cookies are not being set in the response even through i set it with ctx.cookies.set for both get and post requests
my code is in link https://hastebin.com/odoweyunus.js
this was my console.logs
GET
------------ RESPONSE -----------
{ status: 404,
  message: 'Not Found',
  header: [Object: null prototype] {},
  body: undefined }
------------ REQUEST -----------
{ method: 'GET',
  url: '/graphql',
  header:
   { host: 'localhost:3000',
     connection: 'keep-alive',
     'cache-control': 'max-age=0',
     'upgrade-insecure-requests': '1',
     'user-agent':
      'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36',
     accept:
      'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
     'accept-encoding': 'gzip, deflate, br',
     'accept-language': 'en-US,en;q=0.9',
     cookie:
      'name=tandilo; name.sig=nyDQgiinV1lyOZGu9s7xHcE_MYnQxBpAVWmp1MR65i0' } }
###########################
POST
------------ RESPONSE -----------
{ status: 404,
  message: 'Not Found',
  header: [Object: null prototype] {},
  body: undefined }
------------ REQUEST -----------
{ method: 'POST',
  url: '/graphql',
  header:
   { host: 'localhost:3000',
     connection: 'keep-alive',
     'content-length': '1468',
     accept: '*/*',
     origin: 'http://localhost:3000',
     'x-apollo-tracing': '1',
     'user-agent':
      'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36',
     'content-type': 'application/json',
     referer: 'http://localhost:3000/graphql',
     'accept-encoding': 'gzip, deflate, br',
     'accept-language': 'en-US,en;q=0.9' } }
###########################
APOLLO SERVER -------
{ ctx:
   { request: { method: 'POST', url: '/graphql', header: [Object] },
     response: { status: 404, message: 'Not Found', header: [Object] },
     app: { subdomainOffset: 2, proxy: false, env: 'development' },
     originalUrl: '/graphql',
     req: '<original node req>',
     res: '<original node res>',
     socket: '<original node socket>' } }
=====================
Jack c
@soydepr
does anyone in relaity know that status of this framework !!!! dead or alive
Saad Quadri
@saadq
@soydepr Not sure what you mean by that... Koa is a very light wrapper around Node's HTTP which basically comes with no middleware bundled with it so it is pretty feature-complete
There aren't really updates to it because of that
Most of the stuff you use with it will be 3rd-party middleware
Jack c
@soydepr
@saadq i see thanks
Ghost
@ghost~5bb3c7fed73408ce4faa2518

I recently developed a framework is Hyron, which helps to save more backend application development time. Serving for large and complex project development, with high expansion needs. Looking forward to receiving suggestions from everyone
https://docs.hyron.org/

demo.js

module.exports = class {
    static requestConfig(){
        return {
            sayHello : "get"
        }
    }

    sayHello(name){
        return "hello world !"+name;
    }
}

app.json

{
    "base_url" : "http://localhost:3000",
    "services" : {
        "demo" : "./demo.js"
    }
}

bash

$ hyron start

result

> GET http://localhost:3000/demo/say-hello?name=arg

_

Eyal Perry
@_eyalPerry_twitter

I have a koa newcommer question, which might sound silly :)
does a koa middleware have to call await next()?

i.e.:
https://gist.github.com/EyalPerry/6fab361cfd6fdf704e7cd5a43c0ede7e

Jame
@jamemackson
@_eyalPerry_twitter your middleware doesn’t HAVE to call that, but if you want to do something on the way back up the middleware stack, you’ll want to call that and put the “after” logic after the await next();
Naguib Ihab (A.K.A. Nick)
@naguibIhab_twitter
hey guys, I'm still discovering KOA, what does the .middleware() here do?
export default new Router<ApplicationState, ApplicationContext>()
  .get('/', (ctx) => (ctx.body = ctx.greeting.getGreeting()))
  .middleware();
Saad Quadri
@saadq
Is that koa-router or some other router library?
Haven't seen a middleware() method on it before

Hmm... I see. The middleware() method isn't mentioned in the API docs: https://github.com/ZijianHe/koa-router#api-reference

But it does exist in the TypeScript definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/koa-router/index.d.ts#L461

@naguibIhab_twitter Ah found it: https://github.com/ZijianHe/koa-router/blob/master/lib/router.js#L314

It looks like .middleware() is just the same exact thing as the .routes() method

Saad Quadri
@saadq

And .routes() basically just returns a middleware that you use with your main Koa app like:

app.use(router.routes())

which would be the same as

app.use(router.middleware())
Naguib Ihab (A.K.A. Nick)
@naguibIhab_twitter
gotcha thanks @saadq
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);
});