Browse Source

Simplify everything by letting nginx handle routing

Mikael Lindberg 11 years ago
parent
commit
b9ef762cc9
1 changed files with 10 additions and 1 deletions
  1. 10 1
      openresty/nginx.conf

+ 10 - 1
openresty/nginx.conf

@@ -8,7 +8,16 @@ events {
 
 http {
     access_log off;
-    lua_package_path 'CWD/openresty/?.lua;;';	
+    lua_package_path 'CWD/openresty/?.lua;;';
+    location /plaintext {
+        default_type "text/plain";
+        content_by_lua 'ngx.print("Hello, world!")';
+    }
+
+    location /json {
+        default_type "application/json";
+        content_by_lua 'ngx.print(require("cjson").encode({message = "Hello, World!"}))';
+    }
     server {
         listen       8080;
         location / {