Coder Social home page Coder Social logo

cajundb's Introduction

cajundb

Cajundb is a poor man's NoSQL JSON document database with no bells and only one whistle. Cajun is casual and meant to run in a CGI context. Drop it in the CGI-BIN of your favorite Apache webserver and you are nearly good to do.

You will need to create a ./docs directory in this CGI-BIN (writeable by the http server system user), or hack the first few lines of cajundb.pm to put 'docs' elsewhere. More documentation can help, I'll write it.

You will also need to ensure that your http server runs Perl CGI scripts with a Perl environment with the JSON perl module.

To create a new document, just POST it to the cajun.cgi.
If your document has a '_id' property, it will be used as its record ID in the database, otherwise, cajun will create one for you. The _id property must start with an alphanumeric character and must be at least 6 characters long (a-z, A-Z, 0-9, dash, underscore and dot are allowable). Because the document is saved on disk as a _id.json document, be sure to be reasonable with your _ids, or better yet, let cajun.cgi create it for you.

Example:

curl -d '{"hello":"Hello World!","friendly":true}' http://yourserver.domain.net/cgi-bin/cajun.cgi

To get the document back, just request it by _id:

curl http://yourserver.domain.net/cgi-bin/cajun.cgi?tlt725K0yxqOGmvs

To delete the document, use the DELETE http method:

curl -X DELETE http://yourserver.domain.net/cgi-bin/cajun.cgi?tlt725K0yxqOGmvs

To search for document by a simple (perl regexp) search string:

curl http://yourserver.domain.net/cgi-bin/cajun.cgi?search=casual returns a JSON array of document ids where the search 'casual' was found.

curl http://youserver.domain.net/cgi-bin/cajun.cgi?search=casual&include_docs=yes returns a JSON array with all the documents themselves.

Pro-Tip: returns the entier database with: curl http://yourserver.domain.net/cgi-bin/cajun.cgi?search=_id&include_docs=yes

Cajun is meant for very small projects of a few hundred documents. This version has no security, although, it is pretty easy to protect the execution of your CGI scripts with your Apache configuration.

cajundb's People

Contributors

christopheleroy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.