Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 27 15:06
    codecov[bot] commented #1743
  • Jan 27 15:03
    socket-security[bot] commented #1743
  • Jan 27 15:03

    dependabot[bot] on npm_and_yarn

    (compare)

  • Jan 27 15:03

    dependabot[bot] on npm_and_yarn

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

  • Jan 27 15:03
    dependabot[bot] closed #1741
  • Jan 27 15:03
    dependabot[bot] commented #1741
  • Jan 27 15:03
    dependabot[bot] labeled #1743
  • Jan 27 15:03
    dependabot[bot] opened #1743
  • Jan 25 14:27
    iamgabrielsoft labeled #1742
  • Jan 25 14:27
    iamgabrielsoft opened #1742
  • Jan 25 02:56
    codecov[bot] commented #1732
  • Jan 25 02:56
    codecov[bot] commented #1732
  • Jan 25 02:56
    codecov[bot] commented #1732
  • Jan 25 02:55
    codecov[bot] commented #1732
  • Jan 25 02:55
    krisstern synchronize #1732
  • Jan 25 02:55
    codecov[bot] commented #1732
  • Jan 25 02:55
    krisstern synchronize #1732
  • Jan 25 02:54
    krisstern commented #1646
  • Jan 25 02:36
    codecov[bot] commented #1732
  • Jan 25 02:35
    krisstern synchronize #1732
Aaron
@4aron
What if I have a next in a higher middleware
Jeff Hansen
@jeffijoe
Next calls inner middleware
Which is why you have error handlers at the top
Aaron
@4aron
ty
lnkusuin
@inkusu
hi everyone. I have started to develop in Koa. I thinking I want to send mail. What do you recommend?
Jeff Hansen
@jeffijoe
@inkusu Koa has nothing to do with sending email. :)
Steven Hargrove
@hulkish
Hi, can we please retire usage of mz for koa?
specifically, koa-send?
lnkusuin
@inkusu
@jeffijoe
Thanks.
I'm still a beginner at English. I found out the Nodemailer in the node awesome page.
I think to try this library. but I am short on experience in Node. I’m used to PHP.
so, How to send email from Koa or Node Application?
Ghost
@ghost~5ac084b8d73408ce4f93eee9
Anyone know why koajs.com is missing an entire section? Specifically the Application bit
Jeff Hansen
@jeffijoe
@inkusu Try following the readme on node mailers repository?
@fjeddy ¯_(ツ)_/¯
lnkusuin
@inkusu
@jeffijoe
Ok, Thanks. I am using a Nodemailer. No problem so far.
ChrisDillinger7
@ChrisDillinger7

Hey all, huge fan of koa here.. Have been using Koa + Typescript and it's been so.. "convenient" coming from my normal way of doing things with plain js..

This may be a silly question, but is it OK to read from process.env in files that are not my main server.ts file where I instantiate my new Koa() app and .listen() ?

I'd like to use an ENV value to tell my WebApi the hostname of my OTHER server, however I dont like the idea of hardcoding that into my api source code. And my routes are organized like this: (some files/folders omitted).

--- services (folder)
------ service-name (folder)
--------- upstream-providers (folder)
--------- routes.ts <----- this is the file that needs the OTHER_SERVER_HOSTNAME value
--------- service-name-controller.ts
server.ts <------ this is the main file, and where I NORMALLY touch process.env

Chris Dillinger
@ChrisDillinger
Also, woops. Used old account by accident. Just deleted it. This is me ^
( This question is likely falling ill to the 'XY Problem', but I'm doing some exploratory learning so just taking advantage of this to learn. I likely will have other solutions to entertain when I start doing things with some other tooling related to hostnames, service discovery, etc )
Chris Dillinger
@ChrisDillinger
@sqram Regarding ur question on Dec 26th 2017: No, I did not create Dillinger.io and I'm not sure why its called that ha. Repo exists on creator of Nodesource's github ( https://github.com/joemccann )
Nikhil
@nikpat
Hi
can anyone help to pass model as a param to control
Ghost
@ghost~5bb3c7fed73408ce4faa2518
i want to create a benchmark to compare between nodejs frameworks, and i need your help (uncompromising)
https://github.com/hyron-group/benchmark
Ivan
@IvanYakimov
Hi everyone! Could you please help me? I am looking for an idiomatic way to use locales in koa js applications.
pratitid09
@pratitid09
hi everyone, how to save a value globally in Koa.js and change the value as and when required ?
Saad Quadri
@saadq
@pratitid09 I think context state (i.e. ctx.state) might be what you're looking for?
Mike Hamilton
@gorbypark
i have an authentication middleware i'm calling from koa-router router.get("/", roleAdmin, async (ctx, next) => { ... } and I'd like to pass actual roles into roleAdmin, like roleAdmin(['admin', 'user']) or something like that, but I'm not quite sure how
Jame
@jamemackson
if you make your roleAdmin method return a function it should just work.
Mike Hamilton
@gorbypark
hmm, i'm not sure how i can do that, as my rolesAdmin method actually decodes the jwt
and sets ctx.state
if token is bad
Jame
@jamemackson
you just convert it to be a higher order function.
Jame
@jamemackson
so the top level function takes in and stores your parameter and then when the returned function is executed, you can have logic there that can operate how you want based on that variable(s)
Aaron
@4aron
from within a handler (ctx, next) is it OK to add a property to ctx for it to be available through subsequent middlewares?
I understand from app = new Koa(), use app.context.foo
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();