- Add walking transfers - Pick route with minimal walking distance, instead of stop count - Turned `shared` into the new server, client no longer relies on `server` - Prepare to send full route data (instead of string) to the client
25 lines
722 B
Dart
25 lines
722 B
Dart
// User-facing script
|
|
// ignore_for_file: avoid_print
|
|
|
|
import "package:shared/generator.dart";
|
|
import "package:shared/graph.dart";
|
|
import "package:shared/server.dart" as handlers;
|
|
|
|
import "package:shelf_router/shelf_router.dart";
|
|
import "package:shelf/shelf_io.dart" as io;
|
|
|
|
Future<void> init() async {
|
|
print("Initializing...");
|
|
StopState.stops = await Generator.stops.parse();
|
|
StopState.routes = await Generator.routes.parse();
|
|
}
|
|
|
|
void main() async {
|
|
await init();
|
|
final router = Router();
|
|
router.get("/path", handlers.getPath);
|
|
router.get("/stops", handlers.getStops);
|
|
router.get("/routes", handlers.getRoutes);
|
|
await io.serve(router.call, "localhost", 8001);
|
|
print("Listening on localhost:8001");
|
|
}
|