Writing server side Dart code. …and: is it worth it? | by Matias Meno | Dropzone
Server side dart code is very similar to node. The simplest code to actually start an HTTP server in dart is this:
import 'dart:io';
main() async {
final server = await HttpServer.bind(InternetAddress.anyIPv6, 80);
server.listen((HttpRequest request) {
request.response.write('Hello, world!');
request.response.close();
});
}
import 'dart:io';
main() async {
final server = await HttpServer.bind(InternetAddress.anyIPv6, 80);
server.listen((HttpRequest request) {
request.response.write('Hello, world!');
request.response.close();
});
}
you compile your whole server app into a single binary, which is optimized and starts instantly, and ship it in a tiny Container.
No comments:
Post a Comment