Files
masonry/examples/react-app-generator/blog-app.masonry

93 lines
2.1 KiB
Plaintext

// Example blog application with multiple pages, entities, and components
server api {
host "localhost"
port 3001
}
entity User {
name: string required
email: string required unique
role: string default "user"
created_at: timestamp
}
entity Post {
title: string required
content: text required
published: boolean default "false"
author_id: string required
created_at: timestamp
updated_at: timestamp
}
endpoint GET "/api/users" for User auth {
returns User as "json"
}
endpoint POST "/api/users" for User {
param name: string required from body
param email: string required from body
returns User as "json"
}
endpoint GET "/api/posts" for Post {
returns Post as "json"
}
endpoint POST "/api/posts" for Post auth {
param title: string required from body
param content: string required from body
returns Post as "json"
}
page Home at "/" layout public title "My Blog" desc "A simple blog built with Masonry" {
meta description "A simple blog built with Masonry"
section hero type container {
component banner
}
section content type container {
component list for Post {
fields [title, content, created_at]
}
section sidebar type panel {
component widget {
data from "/api/recent-posts"
}
}
}
component footer
}
page Dashboard at "/admin/dashboard" layout admin title "Admin Dashboard" auth {
section stats type container {
component table for User {
fields [name, email, role, created_at]
actions [edit, delete]
}
}
section management type container {
component form for Post {
fields [title, content, published]
validate
}
component table for Post {
fields [title, published, created_at]
actions [edit, delete, publish]
}
}
}
page About at "/about" layout public title "About Us" {
section info type container {
component text {
data from "/api/about-content"
}
}
}