Install dependencies, Zazler and create example database.

# Choose one command to install needed libraries:
apt-get install sqlite3 libpq-dev libmysqlclient-dev libsqlite3-dev zlib1g-dev libncurses5-dev
yum install libpqxx-devel mysql-libs mysql-devel libsqlite3x sqlite-devel zlib ncurses-libs

npm install zazler

sqlite3 /tmp/my.db "create table a(id integer); insert into a values(1);"

File to run with node.js:

var zazler = require("zazler");
zazler.db("db", "sqlite:///tmp/my.db", { read: "*" });

Try if it works:

curl http://localhost/db/a.json
curl http://localhost/db/a.csv

You can see whole database at http://localhost/db/

That's it!

Zazler supports SQLite, MySQL, PostgreSQL. Use URI-s like:


MS-SQL is supported on development version. Ask from info@zazler.com.

Query data

For examples database at http://demo.zazler.com/tutorial/ is used.

At development you want probably use json or xml. Html is nice for debugging.

Database configuration

Database configuration is flexbile. Here we cover first things you want to use.

Limit database access

Parameter read defines which tables and fields are readable. Some examples:

  • read: * − whole database is readable.
  • read: foo − only tables foo is readable.
  • read: * -foo − all tables except foo are readable.
  • read: foo bar − tables foo and bar are readable.
  • read: foo(a b) − only fields a and b are readable on table foo.

To limit data access by content use filters parameter. Like this:

  • filter: { table: "users", where: "id<100" } − if querying data users with smaller id than 100 never been showed.
  • filter: { table: "users", where: "id=auth.id" } − shows only authenticed user row. Need auth configuration parameter.

Full example:

  zazler.db("example", "...", {
     read: "foo bar",
     filter: [ { table: "foo", where: "id>100" } ]

Happy hacking :)

Notice that there are other remarkable features like update database, authentication etc. Read more from database configuration part.