How to use iso-server in google DART language

In this article, i will go to explain about DART iso-server.
  • 2018

DART-ISO Server

DART iso-server display web server library that dynamically loads code from filesystem to handle HTTp requests. The purpose of isoserver:

  • To show, how to dynamically load scripts into an isolate.
     
  • Pay with one may to build a 'hot-swapping' server.

For listing a server request:

#import('dart:io');

#import('isolet.dart');

 

void main() {

  new IsoletServer().defaultRequestHandler = (req, res) {

    res.headers.set(HttpHeaders.CONTENT_TYPE, "text/html");

    res.outputStream.writeString("HelloDART!");

    res.outputStream.close();

  };}

 

For using the library server scripts:
 

#import("dart:io");

#import("isoserver.dart");

 

void main() {

  HttpServer server = new HttpServer();

  Path root = new Path(new Directory.current().path);

  IsoServerHandler handler = new IsoServerHandler(root);

  server.defaultRequestHandler = handler.handleRequest;

  server.listen("127.0.0.1", 8080);
}


Ask Your Question 
 
Got a programming related question? You may want to post your question here
 
© 2020 DotNetHeaven. All rights reserved.