From a2cb159fb7c4d00fed8dfb827ed16b1391eb0c8d Mon Sep 17 00:00:00 2001 From: Andinus Date: Thu, 3 Feb 2022 09:37:01 +0530 Subject: Add routes to Server --- server/.gitignore | 2 ++ server/service.raku | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/server/.gitignore b/server/.gitignore index 35e5575..4f6d02f 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -3,3 +3,5 @@ # Backup files *~ + +dist diff --git a/server/service.raku b/server/service.raku index 2a41f5b..00d1c51 100644 --- a/server/service.raku +++ b/server/service.raku @@ -7,9 +7,25 @@ unit sub MAIN( ); my $application = route { + post -> 'new' { + request-body -> (:$name) { + + } + } + + # Serving static assets. + get -> 'js', *@path { static 'dist/js', @path; } + get -> 'css', *@path { static 'dist/css', @path; } + get -> 'img', *@path { static 'dist/img', @path; } + get -> 'fonts', *@path { static 'dist/fonts', @path; } + + # Serve the app on all paths, it'll handle the routing. + get -> *@path { + static 'dist/index.html'; + } }; -my $host = 0.0.0.0; +my $host = "0.0.0.0"; my $port = 9090; my Cro::Service $http = Cro::HTTP::Server.new( -- cgit 1.4.1-2-gfad0