Created
June 3, 2018 22:51
-
-
Save graphicbeacon/b4600b6ba900ec38e22135c5785efa9f to your computer and use it in GitHub Desktop.
Learn Dart: Create an HTTP server in under 30 seconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "dart:io"; | |
void main() { | |
HttpServer.bind("localhost", 8080).then((HttpServer server) { | |
server.listen((HttpRequest request) { | |
request.response.write("Hello world"); | |
request.response.close(); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can run this by typing
dart main.dart
in the terminal.Watch the accompanying video on youtube.