| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 #library('lil_server'); | |
| 6 | |
| 7 #import('../fling.dart'); | |
| 8 | |
| 9 void main() { | |
| 10 // Create a new server. | |
| 11 HttpServer server = new HttpServer(); | |
| 12 server.handle("/good", (HttpRequest req, HttpResponse res) { | |
| 13 res.setHeader("Content-Type", "text/plain"); | |
| 14 res.write("path: ".concat(req.requestedPath).concat(", prefix: ").concat(req
.prefix)); | |
| 15 res.finish(); | |
| 16 }); | |
| 17 server.handle("/bad", (HttpRequest req, HttpResponse res) { | |
| 18 res.setStatusCode(500); | |
| 19 res.finish(); | |
| 20 }); | |
| 21 server.handle("/app/", ClientApp.create("static")); | |
| 22 server.listen(9090); | |
| 23 | |
| 24 print("Started server at http://localhost:9090/"); | |
| 25 | |
| 26 // Runs the message loop. | |
| 27 Fling.goForth(); | |
| 28 } | |
| OLD | NEW |