summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2022-02-03 09:37:01 +0530
committerAndinus <andinus@nand.sh>2022-02-03 09:37:01 +0530
commita2cb159fb7c4d00fed8dfb827ed16b1391eb0c8d (patch)
treeb82fc1827efd5b7d55e57e29cab9e28d2b584b09
parent4e42cba4f99e0fdbd79e60aaf2e8ffad5a98b822 (diff)
downloadvela-a2cb159fb7c4d00fed8dfb827ed16b1391eb0c8d.tar.gz
Add routes to Server
-rw-r--r--server/.gitignore2
-rw-r--r--server/service.raku18
2 files changed, 19 insertions, 1 deletions
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(