Browse Source

[clace] - Changed to use no_args handlers (#9857)

* Added localhost path

* [clace] - Changed to use no_args handlers
Ajay Kidave 3 months ago
parent
commit
2696c9869f
2 changed files with 16 additions and 4 deletions
  1. 8 2
      frameworks/Python/clace/app.star
  2. 8 2
      frameworks/Python/clace/run.sh

+ 8 - 2
frameworks/Python/clace/app.star

@@ -1,6 +1,12 @@
+def json_no_args():
+    return {'message': 'Hello, world!'}
+
+def text_no_args():
+    return 'Hello, world!'
+
 app = ace.app("testapp",
     routes = [
-        ace.api("/json", lambda req: {'message': 'Hello, world!'}, type=ace.JSON),
-        ace.api("/plaintext", lambda req: 'Hello, world!', type=ace.TEXT)
+        ace.api("/json", type=ace.JSON, handler=json_no_args),
+        ace.api("/plaintext", type=ace.TEXT, handler=text_no_args)
     ]
 )

+ 8 - 2
frameworks/Python/clace/run.sh

@@ -6,15 +6,21 @@ cat <<EOF > /root/clhome/clace.toml
 console = false
 file = false
 access_logging = false
+level = "WARN"
 
 [http]
-host = "0.0.0.0"
+host = ""
 port = 8080
+
+[system]
+enable_compression = false
+
+[app_config]
+cors.allow_origin = ""
 EOF
 
 
 clace server start &
 sleep 2
 clace app create --auth=none --approve /clace /
-clace app create --auth=none --approve /clace tfb-server:/
 tail -f /dev/null