Working project

This commit is contained in:
2024-10-09 18:40:11 -06:00
commit 670cb24095
70 changed files with 154073 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import 'dart:convert';
import 'package:dart_frog/dart_frog.dart';
import 'package:new_backend/shrink_ray.dart';
Future<Response> onRequest(RequestContext context, String urlPath) async {
switch (context.request.method) {
case HttpMethod.put:
case HttpMethod.delete:
case HttpMethod.head:
case HttpMethod.options:
case HttpMethod.patch:
case HttpMethod.post:
return Response(statusCode: 404);
case HttpMethod.get:
final maybeUrl = shrunkUrls[urlPath];
switch (maybeUrl) {
case null:
return Response(statusCode: 404);
default:
return Response(statusCode: 302, headers: {'Location': maybeUrl});
}
}
}