Your First Web Server
Every web application starts with a server. In Clean Language you declare your routes with a simple, readable syntax — and the Frame framework handles compilation, routing, and everything else.
A Clean Language server has two parts: the plugins it uses and the endpoints it exposes.
plugins:\n frame.server\n\nendpoints server:\n GET "/" :\n return http.respond(200, "text/plain", "Hello, World!")\n\n GET "/about" :\n return http.respond(200, "text/plain", "About this server")Server running on http://localhost:8080\nGET / → 200 Hello, World!\nGET /about → 200 About this serverThe plugins: block tells Clean Language which framework modules to load. endpoints server: declares your HTTP routes. Each route is a method + path. http.respond(status, contentType, body) sends the response.
Save the file as server.cln and run it with cleen:
cleen run server.clnServer started on http://localhost:8080cleen run compiles your file and starts the server. Open http://localhost:8080 in your browser to see Hello, World! — no build step, no config, no boilerplate.
Quick recap
- plugins: declares which framework modules your server needs
- endpoints server: defines your HTTP routes
- http.respond(status, contentType, body) — status 200 means success
- cleen run server.cln compiles and starts your server in one step