Slash

Slash is a non-relational open-base and back-end engine that you can use as an API for fixtures and tests in your applications.


Summary


First steps

Register your cluster:

GET /register

Response:

{
    status: 200,
    data: [
        {
            cluster: "/clusters/664dc15d432d2.46363.363b1ga9",
            direct_link: "https://.../clusters/664dc15d432d2.46363.363b1ga9",
            cluster_id: "664dc15d432d2.46363.363b1ga9"
        }
    ]
}

By default, your cluster will have a Users table that will be populated, but you can drop it if you want to.

To drop it:

PUT /clusters/CLUSTER_ID/tables/Users/drop

To delete it:

DELETE /clusters/CLUSTER_ID/tables/Users/annihilate

To get an overview of your cluster, go to:

/clusters/CLUSTER_ID


Creating your own table

POST /clusters/CLUSTER_ID/tables/Cities/init
Body: `schema`

Schema is defined as follows:

{
    property: [
        "type",
        "length"
    ]
}

Example schema:

{
    id: [
        "AutoIncrement",
        11
    ],
    name: [
        "Stringable",
        20
    ],
    location: [
        "ObjectArray",
        110
    ],
    created_at: [
        "AutoDate",
        11
    ]
}

List of all types:

Length is capped at 1500 characters.


How to use

Now that you have a cluster, you can start querying data from its tables.

Examples of requests:

GET /clusters/CLUSTER_ID/tables/Users
GET /clusters/CLUSTER_ID/tables/Users/items
GET /clusters/CLUSTER_ID/tables/Users/17
GET /clusters/CLUSTER_ID/tables/Users?q={name: "Quentin"}
DELETE /clusters/CLUSTER_ID/tables/Users/91/delete
PATCH /clusters/CLUSTER_ID/tables/Users/13/edit
Body: { "name": "Olivier" }
POST /clusters/CLUSTER_ID/tables/Users/create
Body: { "name": "Olivier", "email": "olivier.pro@mail.com" }
POST /clusters/CLUSTER_ID/tables/Users/insert
Body: [{ "name": "Olivier", ... }, { "name": "David", ... }, { "name": "Jean", ... }]
POST /clusters/CLUSTER_ID/tables/Users/import
Body: [{ "name": "Same", ... }, { "name": "Thing", ... }, { "name": "AsInsertBasically", ... }]
GET /clusters/CLUSTER_ID/tables/Users/export

List of all queries:

You can nest queries however you want.

Query examples:

?q={ $limit: 200, $sort: { $startswith: { name: "Q" } } }
?q={ $limit: 50, $sort: { name: -1 }, $or: { $endswith: { name: "n" }, $startswith: { name: "A" } } }
?q={ $chunk: [ 20, 50 ] }
?q={ $regex: { name: "/on$/" } }
?q={ $exists: { name: false }}
?q={ $or: { $lt: { id: 9 }, $gte: { id: 340 } } }
?q={ $sort: { $or: { $startswith: { name: "V" }, $endswith: { name: "t" } } } }
?q={ $regex: { name: "/in$/" }, $sort: { name: -1 }, $slice: [0, 5] }
?q={ $sort: { $or: { $startswith: { name: "V" }, $endswith: { name: "t" } } } }

Queries only work with basic requests for now:

GET /clusters/CLUSTER_ID/tables/TABLE?q={...}


Sandbox

Fixtures files : Cities, Languages

{}