Skip to content
Snippets Groups Projects
Unverified Commit 01e16cb0 authored by Louis's avatar Louis :fire:
Browse files

Enhance Example

parent f7d1aad6
No related branches found
No related tags found
1 merge request!2Scripting
...@@ -3,10 +3,18 @@ print("We're going to the races"); ...@@ -3,10 +3,18 @@ print("We're going to the races");
foo = 1 + 1; foo = 1 + 1;
r = empty_response(); r = empty_response();
r:set_status(404); r:set_status(200);
-- r:set_header("foo", "bar"); r:set_header("X-Powered-By", "Swerve");
-- r:set_body() r:set_header("Content-Type", "text/plain");
r:set_body("This is my only response");
return response(200, "application/json", json_encode({ foo = 123 })); --return r
r = response(200, "application/json", json_encode({ foo = 123 }));
r:unset_body();
r:set_status(204);
return r
-- return response(200, "application/json", '{ "foo": ' .. foo .. ' }') -- return response(200, "application/json", '{ "foo": ' .. foo .. ' }')
\ No newline at end of file
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<body> <body>
<h1>It's Swervin' Time</h1> <h1>It's Swervin' Time</h1>
<p>This page is part of the swerve example, and includes a stylesheet and stuff.</p> <p>This page is part of the swerve example, and includes a stylesheet and stuff.</p>
<img src="/files/adorable-puppy.jpg">
<script async src="js/say_hello.js"></script> <script async src="js/say_hello.js"></script>
</body> </body>
</html> </html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment