deno 和 dart 好像啊

2020-11-04 14:39:13 +08:00
 chenhui7373

···

import { serve } from "https://deno.land/std@0.76.0/http/server.ts";

const s = serve({ port: 8000 });

console.log("http://localhost:8000/");

for await (const req of s) {

req.respond({ body: "Hello World\n" });

}

···

······

import 'dart:io';

Future main() async {

var server = await HttpServer.bind(

InternetAddress.loopbackIPv4,

8000);

print('Listening on localhost:${server.port}');

await for (HttpRequest request in server) {

request.response.write('Hello world\n');

await request.response.close();

}

}

······

1982 次点击
所在节点    Dart
1 条回复
bysgatn3
7 天前
其实完全不像。
dart 有太多令人感到诡异的语法,特别是函数式。
我觉得 C#跟 JS+TS 更像。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/721720

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX