Last active
August 1, 2019 09:59
-
-
Save venkatd/f67728fb2ed365233dabde42e6190eb8 to your computer and use it in GitHub Desktop.
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'; | |
Future<void> startPlayServer(int port) async { | |
HttpServer server = await HttpServer.bind( | |
InternetAddress.loopbackIPv4, | |
port, | |
); | |
await for (var request in server) { | |
_handleRequest(request); | |
} | |
} | |
void _handleRequest(HttpRequest request) async { | |
try { | |
await play(); | |
await request.response.close(); | |
} catch (e) { | |
print('Exception in _handleRequest'); | |
print(e); | |
} | |
} | |
Future<void> play() async { | |
print("hello at" + DateTime.now().toIso8601String()); | |
return null; | |
} |
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
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "play", | |
"type": "shell", | |
"command": "curl", | |
"args": [ | |
"http://localhost:9999" | |
], | |
"problemMatcher": [], | |
"presentation": { | |
"echo": true, | |
"reveal": "silent", | |
"focus": false, | |
"panel": "shared", | |
"showReuseMessage": true, | |
"clear": false | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment