GithubHelp home page GithubHelp logo

synth's People

Contributors

maiah avatar sqs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

synth's Issues

Response redirect

Provide a redirect method to Response object that can be used by middlewares and user request-handlers.

Proposed usage:

res.redirect('/some/path/here');

Error on pageload

When I am using your example setup and try to run it with the latest sdk at revision 14458 or revision 14167 I receive following error when I visit http://localhost:7000

Unhandled exception:
NoSuchMethodError : method not found: 'call'
Receiver: Array
Arguments: []
#0      _HttpServer.listenOn.onConnection.<anonymous closure> (dart:io:3151:11)
#1      _HttpConnection._onConnectionClosed (dart:io:3062:14)
#2      _HttpConnectionBase._onError (dart:io:3010:24)
#3      _HttpConnection._HttpConnection.<anonymous closure> (dart:io:3058:40)
#4      _HttpParser.writeList (dart:io:4332:14)
#5      _HttpConnectionBase._onData._onData (dart:io:2991:41)
#6      _SocketBase._multiplex (dart:io-patch:399:26)
#7      _SocketBase._sendToEventHandler.<anonymous closure> (dart:io-patch:500:20)
#8      _ReceivePortImpl._handleMessage (dart:isolate-patch:37:92)

This works on revision 13851.

I tried to debug this but couldn't get to the bottom of it. Not sure if this is a language bug or a bug in the framework.

Any help would be greatly appreciated.

Matt

Enhanced request object

Create an enhanced HTTP request object that can be used by request handlers and middlewares.

Using futures in routes causes issues when doing async write to response stream

Long story short. I have routes that does some database lookup with an API based on Futures.

Then problem is, that the lines 102-107 in ehttp.dart makes it impossible to do this since the outputStream is being closed as soon as the inputstream is.

synthReq.inputStream.onClosed = () {
        // Close response stream if needed.
        if (!synthRes.outputStream.closed) {
          synthRes.outputStream.close();
        }
      };

Perhaps I'm doing something wrong.

Removing these lines does make it work but it has a sideeffect in my middlewares.

Route-specific Middleware

Provide a way to add a middleware on a specific route. The code is something like below.

...
void myMiddleware(req, res, next) {
  ...
}
...

route('GET', '/', myMiddleware, (req, res)
    => res.write('Hello, World!'));

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.