Skip to content

Syntax

TeraLang is a language designed for quickly creating mock APIs. It’s ideal for frontend developers who need fast, realistic endpoints without setting up a full backend.

This guide introduces you to the basic syntax of TeraLang so you can get productive immediately.

At its core, a TeraLang file consists of route definitions. Here’s the basic syntax:

route "/hello" GET: {
json: {
message: "Hello, world!"
}
}
  • route “/hello” — declares the endpoint path.

  • GET: — specifies the HTTP method (GET, POST, PUT, DELETE, etc.).

  • json: — the JSON object returned as the response body.

Avoid complex logic — TeraLang is meant for simple mocks, not production.

Use consistent formatting to keep files readable.

Now that you understand the syntax, you’re ready to:

  • Build mock endpoints for your app

  • Integrate them with fetch/AJAX

  • Share mock servers with teammates