Scaffold is an easy-to-use HTTP API generator that abstracts away writing any code and replaces it with an elegant configuration system. It allows you to quickly set up simple endpoints, whether for prototyping or getting boring/repetitive work done quickly.
- Easy / Fast to learn Syntax (YAML & SQL)
- Golang's Performance
- Easy to use database (Embedded sqlite)
- Fast development time
- You may want to create a symlink for the cli to call it from anywhere
- Initialize the project
Scaffold init <your project name>
- Edit the main.yml file in the project
- Run Scaffold on your project
Scaffold run <your project name>
This example defines four endpoints: one to create users, one to retrieve a user, one to delete a user, and one to get all the users
database:
init-query: |
CREATE TABLE IF NOT EXISTS user (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
age INTEGER
);
path: ./main.db
$model:
- name: add_user_model
query-template: INSERT INTO user (name, age) VALUES ('%s', %s)
json-template:
- Name: Name
Type: string
- Name: Age
Type: integer
- name: main_model
query-template: SELECT * FROM user;
- name: delete_user_model
query-template: DELETE FROM user WHERE name='%s'
json-template:
- Name: Name
Type: string
- name: select_user_model
query-template: SELECT * FROM user WHERE name='%s'
json-template:
- Name: Name
Type: string
$controller:
- name: main_controller
fallback: Something went wrong
model: main_model
- name: second_controller
fallback: Something went wrong
model: add_user_model
- name: third_controller
fallback: Something went wrong
model: delete_user_model
- name: fourth_controller
fallback: Something went wrong
model: select_user_model
server:
port: 8080
$service:
- controller: main_controller
route: /show_user
- controller: second_controller
route: /add_user
- controller: third_controller
route: /delete_user
- controller: fourth_controller
route: /select