1

I have a very simple dart webService and i would like to deploy it to apache webServer.

#import('dart:io');
void main() {
  HttpServer server = new HttpServer();
  server.listen('127.0.0.1', 8080);

  server.defaultRequestHandler = (HttpRequest request, HttpResponse response){
 // response.outputStream.write("hello World".charCodes());
 // response.outputStream.close(); 

    File f = new File("test.txt");
    //File f = new File("index.html");
    f.exists().then((bool exist){
      f.openInputStream().pipe(response.outputStream);
    });
  };
}

When you call with GET 127.0.0.1:8080 from your browser, it reads a file test.txt and shows output in your browser.

How do i deploy that to an apache webserver somewhere online?

2
  • Because your code above works fine in the stand-alone Dart VM, can you clarify why you want to "deploy it to apache webServer" ? That might help us answer the question more accurately. Thanks! Commented Sep 13, 2012 at 18:28
  • I have few webservices running on django (vm with ubuntu) and others on webApi(IIS). I would like to setup a new VM ubuntu server, install apache webserver and just run simple dart webservices. The user should be able to send data with HTTP POST or GET and also receive data (xml or json) Commented Sep 13, 2012 at 19:25

2 Answers 2

4

mod_dart might work, but you can also run Apache as a proxy in front of your Dart server. Many deployments of node.js have a proxy in front for load balancing, caching, etc. This same technique applies to Dart.

Sign up to request clarification or add additional context in comments.

Comments

0

Try mod_dart (https://github.com/sam-mccall/mod_dart).

2 Comments

that was my fear. i hoped for something new
mod_dart is now dead project. (For anyone reading this in 2012)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.