Can DART application be hosted in a webserver like Apache?

Yes, it can (although that's not its primary use case).

From Google Plus, 28th Feb 2013:

Finally I managed to make Dart work in Apache CGI ! I didn't find any information about this, so I tryed by myself. Here is how I did it (Apache 2.2, and Ubuntu) ...

From news.dartlang.org, 26th May, 2012

Today, Sam McCall announced mod_dart: the ability to run Dart apps embedded in Apache! Just like PHP, Perl, Python, and many other scripting languages, you can now use Dart to power your server-side web apps from inside the Apache web server.

Both these are "proof of concepts", but they show that Dart can be embedded within a web server such as Apache.

Now the "but..."

Although it's proven that Dart can be embedded within a webserver, Dart is more like node.js, in that the server side dart binary provides a VM for an application to use. That application could include its own webserver, for example:

main() {
  var server = new HttpServer();

  server.addRequestHandler(
     (req) => true,   // matcher - should this function handle this request?
     (req, res) {     // handler - what should happen when this request matches?
       res.outputStream.write("${req.method}: ${req.path}"); // eg: GET: /foo
       res.outputStream.close();
     });

  server.listen('127.0.0.1', 8080);

Tags:

Dart