Skip to content

Commit

Permalink
tiny fixes (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
codekeyz authored Dec 22, 2023
1 parent 4994659 commit c05d459
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 4 additions & 1 deletion yaroo/lib/src/_router/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,8 @@ abstract interface class Route {
}

static FunctionalRouteDefinition handler(HTTPMethod method, String path, RequestHandler handler) =>
FunctionalRouteDefinition(HTTPMethod.GET, path, handler);
FunctionalRouteDefinition(method, path, handler);

static FunctionalRouteDefinition notFound(RequestHandler handler, [HTTPMethod method = HTTPMethod.ALL]) =>
FunctionalRouteDefinition(method, '/*', handler);
}
3 changes: 2 additions & 1 deletion yaroo/lib/src/_router/utils.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'dart:io';

String cleanRoute(String route) {
return route.replaceAll(RegExp(r'/+$'), '').replaceAll(RegExp(r'/+'), '/');
final result = route.replaceAll(RegExp(r'/+'), '/').replaceAll(RegExp(r'/$'), '');
return result.isEmpty ? '/' : result;
}

String symbolToString(Symbol symbol) {
Expand Down
4 changes: 2 additions & 2 deletions yaroo/lib/src/core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ class AppServiceProvider extends ServiceProvider {
autoReload: false,
trimBlocks: true,
leftStripBlocks: true,
loader: FileSystemLoader(paths: ['public']),
loader: FileSystemLoader(paths: ['public', 'templates'], extensions: {'j2'}),
);
app.useViewEngine(JinjaViewEngine(environment));
app.useViewEngine(JinjaViewEngine(environment, fileExt: 'j2'));
}
}

Expand Down
2 changes: 1 addition & 1 deletion yaroo/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
git:
url: https://github.com/codekeyz/pharaoh.git
path: packages/pharaoh
spanner: ^1.0.1+1
spanner: ^1.0.1+2
spookie: ^1.0.2+1
meta: ^1.11.0
collection: ^1.18.0
Expand Down

0 comments on commit c05d459

Please sign in to comment.