Giter VIP home page Giter VIP logo

Comments (5)

jonathanong avatar jonathanong commented on April 16, 2024 1

What would that accomplish?

from koa.

blai avatar blai commented on April 16, 2024

well, in Node.js server.listen() also take a callback, with the first argument being error. There has not been an easy way to doing something like: wait for the server to start listening (some app might take a bit to instantiate all the middleware dependencies, e.g. a db connection). Or something like, if the server failed to start listening because the port is in use, try start in a different port. I guess this (returning promise) opens up some possibilities, just a random thought.

from koa.

tj avatar tj commented on April 16, 2024

I'd like to defer that sort of boot logic, ideally you'd get everything ready and then .listen() for connections, but thankfully most database drivers buffer requests and so on so usually .listen() at the bottom without a callback is just fine

from koa.

jonathanong avatar jonathanong commented on April 16, 2024

@visionmedia why not just remove app.listen()? people are inevitably going to ask for more like with Express. ie i wanted expect: 100-continue support, but it's easier just to create the server myself. you use http.createServer(app.callback()) in half your tests and examples anyways.

from koa.

tj avatar tj commented on April 16, 2024

I find it useful, just need to be certain that it's not going to change and turn into some giant wtf

from koa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.