voscausa voscausa - 8 months ago 63
Dart Question

How to use dart pub serve alongside another webserver sdk

I'am new to dart. I try to run a dart client and an appengine SDK server. The appengine SDK for Python serves dynamic HTML with jinja.

During development I like to use dart pub serve to serve the dart code and the app engine SDK to serve HTML and CSS assets.

I used stagehand to setup web-simple dart in my Pycharm app engine project. But I could not figure out how to serve the HTML and CSS assests from the appengine SDK.

Answer Source

There is nothing special provided by Dart for this scenario.

Usually it's suggested to use a proxy server that forwards requests for Dart resources to pub serve and everything else to your custom server (appengine, ...). This can be done with a few lines of code using the shelf, shelf_proxy, and shelf_static packages.

Dart is moving to bazel as build tool instead of pub serve (limited preview available). They might take a different approach with or after the switch.