goserver

command
v0.0.0-...-437b54e Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: GPL-2.0 Imports: 15 Imported by: 0

README

goserver

A simple service which executes BASIC, in your browser.

Implementation

The HTTP server binds to localhost:8080, and handles two events:

  • GET /
    • Serves a single index.html file, containing javascript magic.
  • POST /
    • Reads the contents of the HTTP POST and executes the BASIC code stored in the code parameter.

All other requests will result in a 404 error-code.

Updating data/index.html

Because we want to ship a single binary we embed the contents of data/index.html inside our binary - meaning that if you wish to make changes to the content you need to do a little extra work.

The contents of data/index.html are stored in a compiled form inside the file static.go. If you make changes to the source file you need to rebuild it.

Install implant, if you don't already have it:

go get -u github.com/skx/implant

Then run this to update the static.go file:

implant -output static.go data/

Finally you can rebuild the binary:

go build .

Documentation

Overview

The goserver utility is a simple HTTP server which allows you to interactively run BASIC scripts via your browser.

The purpose of this utility is to allow users to experiment with graphics, which it allows by the addition of several custom functions to the BASIC environment.

The additions make it easy to change the colour of the pixels, draw points, lines, circles, and view a rendered image containing the output.

Graphing SIN and similar functions becomes very simple and natural.

Jump to

Keyboard shortcuts

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