Web development is constantly evolving, and sometimes the best way to move forward is to rethink how we serve our applications. If you are looking for a lightning-fast, zero-friction way to render server-side JavaScript pages natively within your web server, it is time to look at AxonASP integrated with the Caddy web server.
We are rewriting the future of server-side page rendering. By embedding the AxonASP runtime directly into Caddy, you get a powerful environment that executes server-side JavaScript right inside your HTTP handlers. Add Caddy's automatic HTTPS, and you can launch secure, dynamic services in seconds.
Here is a step-by-step guide on how to create a JavaScript-powered web page and launch it immediately using Caddy and AxonASP.
AxonASP provides a custom Caddy module that handles everything internally. This Zero-Process Architecture means you don't have to configure FastCGI workers, reverse proxies, or external daemons.
You have two simple options to get the server:
The fastest way to start is to download a pre-compiled Caddy executable containing the embedded AxonASP module directly from the AxonASP repository release channel. Grab the version for your OS (Windows, Linux, or macOS) and place it in your system's binary path.
If you prefer compiling it yourself or want to add other Caddy plugins, you can use xcaddy
(the official Caddy builder tool).
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
xcaddy build --with g3pix.com.br/axonasp/caddy
Caddy's configuration is famously simple. To enable AxonASP processing, you just need to add the axonasp
directive inside a route
block alongside the standard file_server
.
Create a file named Caddyfile
in your project folder with the following configuration:
:8080 {
root * ./www
route {
axonasp {
site_name My_Web_site
global_asa_path ./www/global.asa
}
file_server
}
}
This tells Caddy to serve files from the ./www
directory and route applicable pages through the AxonASP execution engine.
Now for the fun part. Let's create a dynamic web page using server-side JavaScript.
Create a folder named www
in the same directory as your Caddyfile. Inside that folder, create a file named default.asp
.
Add the following code to default.asp
:
<%@Language="JavaScript"%>
<%
// Server-side JavaScript logic
var serverTime = new Date();
var engine = Request.ServerVariables("SERVER_SOFTWARE");
var visitorIP = Request.ServerVariables("REMOTE_ADDR");
%>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>AxonASP JavaScript Rendering</title>
<style>
body { font-family: system-ui, sans-serif; background: #f4f4f9; color: #333; padding: 2rem; }
.card { background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); max-width: 600px; margin: 0 auto; }
h1 { color: #0056b3; }
.metric { font-weight: bold; color: #e83e8c; }
</style>
</head>
<body>
<div class="card">
<h1>Rendered Natively with JS! 🚀</h1>
<p>This page was generated completely server-side using JavaScript inside Caddy.</p>
<hr>
<ul>
<li><strong>Current Server Time:</strong> <span class="metric"><%=serverTime.toUTCString()%></span></li>
<li><strong>Powered by:</strong> <span class="metric"><%=engine%></span></li>
<li><strong>Your IP:</strong> <span class="metric"><%=visitorIP %></span></li>
</ul>
</div>
</body>
</html>
By declaring <%@Language="JavaScript"%>
at the top, AxonASP knows to evaluate the server-side blocks using its JavaScript engine before sending the final HTML to the client.
With your Caddyfile
and your default.asp
page ready, it is time to go live.
Open your terminal, navigate to the folder containing your Caddyfile
, and run:
caddy run
Open your browser and navigate to http://localhost:8080
.
You will immediately see your page, dynamically rendered by JavaScript on the server. Because AxonASP integrates deeply with Caddy, it natively respects standard index files (like default.asp
), meaning you don't even need to type the file name in the URL.
You just spun up a fully functional server-side JavaScript rendering engine in less than a minute. This setup scales beautifully, natively supports Caddy's automatic HTTPS for production domains, and gives you a rapid, highly performant environment for building the next generation of web services.
Have you built any dynamic services with Caddy recently? Drop your thoughts in the comments below!