Introduction
ODB is a powerful BaaS (Backend as a Service) based on basics concepts, such as SQLite database and an API Builder, to create fantastic APIs for your apps.
Create a database
Get started by creating a database or login. In both cases it will create a database linked to your email.
What you'll have
Once you are login you will have a SQLite database ready to be use from the browser or the terminal. 👏👏👏
Your backend in three steps
You only have to create a table, insert data, and define the schema of your API.
Create a table
CREATE TABLE IF NOT EXISTS friend (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT
);
Add some data
INSERT INTO friend (name) VALUES ('Jennifer');
INSERT INTO friend (name) VALUES ('Courteney');
INSERT INTO friend (name) VALUES ('Lisa');
Define an API
api:
service: web-app
query: SELECT * FROM friend LIMIT COALESCE(@limit, 10)
method: GET
path: /friend
headers: {
Access-Control-Allow-Origin: '*',
Access-Control-Allow-Methods: 'GET',
Cache-Control: 'max-age=3600',
}
Enjoy it ;)
fetch('https://odb.dev/api/friend?limit=2', {
method: 'GET',
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
}
});
To get the toke you can to run:
token:
service: web-app