Skip to content

Instantly share code, notes, and snippets.

@graphicbeacon
Created June 3, 2018 22:51
Show Gist options
  • Save graphicbeacon/b4600b6ba900ec38e22135c5785efa9f to your computer and use it in GitHub Desktop.
Save graphicbeacon/b4600b6ba900ec38e22135c5785efa9f to your computer and use it in GitHub Desktop.
Learn Dart: Create an HTTP server in under 30 seconds
import "dart:io";
void main() {
HttpServer.bind("localhost", 8080).then((HttpServer server) {
server.listen((HttpRequest request) {
request.response.write("Hello world");
request.response.close();
});
});
}
@graphicbeacon
Copy link
Author

graphicbeacon commented Jun 3, 2018

You can run this by typing dart main.dart in the terminal.

Watch the accompanying video on youtube.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment