import "package:shared/graph.dart";
import "package:shelf/shelf.dart";

import "utils.dart";

Response getStops(Request _) {
  final stops = StopState.stops.values;
  final jsonBody = encodeJsonList(stops);
  return Response.ok(jsonBody, headers: corsHeaders);
}

Response getRoutes(Request _) {
  final routes = StopState.routes.values.where((route) => !route.fullName.startsWith(")"));
  final jsonBody = encodeJsonList(routes);
  return Response.ok(jsonBody, headers: corsHeaders);
}
