REST Services with nginx

Notes for making nginx REST Services

Location along with regex is your friend


# Location Notes
location ~ ^/apps/test/api/call/(.*)/notes$ {

default_type ‘text/plain’;

echo $1;

}

Advertisements

3 thoughts on “REST Services with nginx

    • This is not a complete instruction for rest services. This i have made only as stub. You may like to look at source code of sso module to build and use json with nginx.

      If you are going to use mysql along with nginx then i suggest you can try openresty or use nginx with drizzle and rds-json-nginx-module.

      A sample end point looks like this with mysql and rds-json-module

      # Location Task
      location /api/task {
      set $sql ‘select A.*, B.prj_name from task A, project B WHERE A.tsk_prj_id = B.prj_id’;
      drizzle_query $sql;

      drizzle_pass do;
      rds_json on;
      drizzle_connect_timeout 500ms; # default 60s
      drizzle_send_query_timeout 2s; # default 60s
      drizzle_recv_cols_timeout 1s; # default 60s
      drizzle_recv_rows_timeout 1s; # default 60s
      }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s