takev / mod_okioki Goto Github PK
View Code? Open in Web Editor NEWAn apache module that offers a RESTful data service with a PostgresQL server.
Home Page: http://www.vosgames.nl/
License: GNU General Public License v3.0
An apache module that offers a RESTful data service with a PostgresQL server.
Home Page: http://www.vosgames.nl/
License: GNU General Public License v3.0
mod_okioki - RESTful data service, apache module ================================================ Okioki is a Maori word, meaning: to rest. There is a lot of infrastructure build for webservices, such as load balances, caching/proxy servers, compression, encryption, authentication, auhtorization and logging. By having this Okioki module between the application server and its database as a shim will give you access to all this infrastructure. Okioki was designed to make it really easy to make such a RESTful data service. Design constraints for this module are: - Correctness, i.e. everything is checked, don't allow sql injection. - Performance, the primary reason to make this in C. - Simple to use/configure. Anatomy of a service -------------------- A webservice is identified by the http method and url. In Okioki the url is defined with an extended regular expression, with optional groups. Each of the webservices has an SQL statement associated with it. Parameters used by the SQL statement can be gotten from the http client in several ways. - The first set of parameters are parsed from the url using its matching regular expression and groups. - The second set is parsed from the query string. - The third set from the cookies - And the last set from the posted urlencoded form data. The result of the SQL statement is written to the http client in a CSV (comman seperated values). The result may also be written to a cookie (only the value from the first row of the result). It is recommended to create stored procedures for the more complicated services. Example apache config --------------------- Below is part of an apache configuration file. The first part loads the module. - Use of DBD commands to prepare the sql statements and use a resource pool - Use of the Rewrite engine to convert RESTful URLs to simple urls. - The OkiokiCommand has assigned to it: * a http method, * an url (under /tautoru), * That the result should be returned in CSV form, * the prepared statement to use, * and the parameters from a GET/POST form, to be used with the prepared statement <IfModule !mod_okioki.c> LoadModule okioki_module modules/mod_okioki.so </IfModule> <VirtualHost *:80> DBDriver pgsql DBDParams "host=localhost dbname=tautoru user=tautoru password=xxxxxx" DBDPrepareSQL "select id, name from otp_algorithm;" sql_test DBDPrepareSQL "select name from otp_algorithm where id = %hhd;" sql_test_id #RewriteLog "/var/log/apache2/rewrite.log" #RewriteLogLevel 9 RewriteEngine on RewriteRule ^/tautoru/test/(.*) /tautoru/test_id?id=$1 <Location /tautoru> SetHandler okioki-handler OkiokiCommand GET /test CSV sql_test OkiokiCommand GET /test_id CSV sql_test_id id </Location> </VirtualHost>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.