Declarative Endpoints, Request Validation, and JSON Protocols
WebForge automatically creates structured, typed REST API endpoints from your TechScript database declarations. This enables seamless, zero-boilerplate frontend-to-backend communication without manual endpoint controllers or SQL query wiring.
When a table is defined in TechScript:
database Blog:
table posts:
title is text
content is text
WebForge automatically binds two standard REST routes:
- Method:
GET - Request Headers:
Accept: application/json - Response Status:
200 OK - Response Body:
[ { "id": 1, "title": "Introducing WebForge", "content": "Full-stack development made intuitive." } ]
- Method:
POST - Request Headers:
Content-Type: application/json - Request Body:
{ "title": "New Post", "content": "This is content." } - Response Status:
200 OK - Response Body:
{ "status": "ok", "id": 2 }
In your frontend code, you can trigger REST API calls directly without writing fetch() or axios:
when SavePostBtn is clicked:
send PostContentInput to /api/posts
show message "Post created successfully!"
Under the hood, WebForge generates an asynchronous fetch() payload, captures the input value, executes the POST request, handles network exceptions, and displays the reactive toast notification.
You can test WebForge endpoints with standard tools:
# Query notes
curl -X GET http://127.0.0.1:3000/api/notes
# Insert a note
curl -X POST http://127.0.0.1:3000/api/notes \
-H "Content-Type: application/json" \
-d '{"content": "Automated test note"}'Invoke-RestMethod -Uri "http://127.0.0.1:3000/api/notes" -Method Get