You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.
// This example starts a server and listens for connections on a randomly assigned free port. The application responds with "Hello World!" for requests to the root URL. All other routes are answered with a 404 not found message.
// The allocated port is accessed via the `app.port`` property. The example takes advantage of the fact that goja returns the value of the last expression evaluated.
//
//
// In this example, the name of the constructor is `Application`, but the name you use is up to you.
func Example_random() {
const SCRIPT = `
const app = new Application()
app.get("/", (req, res) => {
res.text("Hello World!")
})
app.listen()
app.port // goja runtime returns the last evaluated expression