web

package module
v0.3.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

README

Weblang language (Go package)

Weblang

Go Reference

Go-powered new programming language for web development

This is still very early version, so please use only for testing purposes, because it's not production ready yet.

Example

package main

import (
	"context"

	"webimizer.dev/web/controller"
	"webimizer.dev/web"
)

func main() {
	vm := web.VM{}
	vm.InitVM("web/src", "web/generated")
	vm.DefineFunc("MainController", "index", controller.Handler(func(rw http.ResponseWriter, r *http.Request) {
		fmt.Fprint(rw, "Welcome from weblang!")
	}))
}

Full example: https://github.com/vaclovas2020/webtest

Documentation

Index

Constants

View Source
const Version string = "v0.3.15"

Weblang version string

Variables

This section is empty.

Functions

This section is empty.

Types

type VM

type VM struct {
	// contains filtered or unexported fields
}

Main VM struct

func (*VM) DefineFunc added in v0.2.4

func (vm *VM) DefineFunc(className string, methodName string, handler base.FunctionHandler)

Set handler to specific class method (works with external methods only)

func (*VM) InitVM

func (vm *VM) InitVM(sourceDir string, byteCodeDir string)

Initialize VM with given context and arguments. Please provide correct sourceDir (directory of Web language source files) and byteCodeDir (direcotry for bytecode files)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL