GNDLine is a next-generation web runtime with Go as its primary language.
Yes. This exact file runs as a page.
<%@ LANGUAGE="GND.Go.Yaegi" %>
<%
import . "OpenASP"
func run() {
Response.Write("<h1>Hello from Go on GNDLine.</h1>")
}
%>
Yes. This exact file runs as a JSON endpoint.
<%@ LANGUAGE="GND.Go.Yaegi" %>
<%
import . "OpenASP"
func run() {
Response.WriteJSON(map[string]any{
"ok": true,
"message": "Hello from GND.Go.Yaegi via .api",
})
}
%>
The packaged examples cover these core host and page surfaces:
The packaged page examples run on:
Enter the package directory and run:
./bin/gndl
Install this in global.asa to register routes at app startup.
<script language="GND.Go.Yaegi" runat="server">
import . "OpenASP"
func Application_OnStart() {
router, _ := AsRouter(Server.CreateObject(".Router"))
router.GET("/routed.asp", "/target.asp")
router.GET("/api/*", "/api/json.api")
router.GET("/users/{id}.asp", "/auth/home.asp")
Application.Use(router)
}
</script>
Install this in global.asa to protect routes before page entry.
<script language="GND.Go.Yaegi" runat="server">
import . "OpenASP"
func Application_OnStart() {
auth, _ := AsAuthBySession(Server.CreateObject(".AuthBySession"))
auth.Item("/member/*", "MemberID", "/login.asp")
auth.Item("/admin/*", "AdminID", "/login-admin.asp")
Application.Use(auth)
}
</script>
This page uses classic VBScript-style CreateObject(...).
<%
set dic = CreateObject("Scripting.Dictionary")
dic("foo") = "bar"
%>
<h1><%= dic("foo") %></h1>
This page calls an OpenVBS function from Go.
<%@ LANGUAGE="GND.Go.Yaegi" %>
<script language="GND.OpenVBS" runat="server">
function GetMessage()
GetMessage = "this is OpenVBS in Go."
end function
</script>
<%
func run() {
message := GetMessage()
Response.Write(message)
}
%>
This page calls a Go function from OpenVBS.
<%@ LANGUAGE="GND.OpenVBS" %>
<script language="GND.Go.Yaegi" runat="server">
func GetMessage() string {
return "this is Go in OpenVBS."
}
</script>
<%
v = GetMessage()
Response.Write v
%>
BILDB can connect your database like a ADODB.
<%
conn("SELECT * FROM TMember WHERE name=?", "jenny").foreach(function(r)
Response.Write r(0).name & ":" & r("id")
Response.Write r(1).name & ":" & r("name")
Response.Write r(2).name & ":" & r("time")
end function)
%>