• Stars
    star
    935
  • Rank 48,537 (Top 1.0 %)
  • Language
    Go
  • License
    MIT License
  • Created about 4 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Turn shell commands into web services

webify

Turn functions and commands into web services

Build Status Go Report Card MIT License

For a real world example, see turning a Python function into a web service.

Overview

webify is a very basic CGI server which forwards all requests to a single script. A design goal is to be as zero-config as possible.

webify invokes your script and writes the request body to your process' stdin. Stdout is then passed back to the client as the HTTP response body.

If your script returns a non-zero exit code, the HTTP response status code will be 500.

Installation

webify is available from the project's releases page.

On macOS, it can also be installed via MacPorts:

sudo port install webify

Usage

# Make a web service out of `wc` to count the characters in the request body.
$ webify wc -c
2020/08/25 12:42:32 listening on :8080, proxying to wc -c

...

$ curl -d 'This is a really long sentence' http://localhost:8080
30

Official Docker image

The official Docker image is beefsack/webify.

It can be configured using the following environment variables:

  • ADDR - the address to listen on inside the container, defaults to :80
  • SCRIPT - the command to execute, defaults to /script

Mounting script and running official image

$ docker run -it --rm -p 8080:80 -v /path/to/my/script:/script beefsack/webify:latest
2020/08/25 04:27:46 listening on :80, proxying to /script

...

$ curl -d 'Some data' http://localhost:8080

Building a new image using official image as base

Create a Dockerfile like the following:

FROM beefsack/webify:latest
COPY myscript /script

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

More Repositories

1

go-astar

Go implementation of the A* search algorithm
Go
563
star
2

go-rate

A timed rate limiter for Go
Go
390
star
3

angular-d3

D3.js directives for AngularJS
HTML
109
star
4

git-mirror

Host Git repository mirrors with ease
Go
107
star
5

GDScript-sublime

Godot Engine GDScript syntax highlighting for Sublime Text
GDScript
65
star
6

bgg-ranking-historicals

34
star
7

zsh-simplicity

Minimal composable configs for zsh
Shell
19
star
8

gobndl

Bundle Go dependencies inside Go projects
Go
12
star
9

bgg-climbers

Go
11
star
10

ruby-continent

A ruby library for continents and their countries
Ruby
7
star
11

gar

Go application archiver inspired by JAR for Java
Go
7
star
12

bgg-ranked-csv

Go
6
star
13

go-jch

Jump Consistent Hash implementation in Go
Go
6
star
14

geekdo-chart

A simple application to display Geekdo rankings (boardgamegeek, videogamegeek and rpggeek) as charts over time
Go
4
star
15

go-geekdo

Go
4
star
16

geekdo-search-scraper

Go
4
star
17

github-language-colors

Scrape the GitHub language colors used in the language bar
Go
4
star
18

jch-rs

Jump Consistent Hash for Rust.
Rust
3
star
19

unrealscript-sublime

Deprecated, see https://github.com/Zinggi/UnrealScriptIDE
3
star
20

bash-powerline-installer

Powerline in your bash terminal
Shell
2
star
21

whois_server

2
star
22

domain.availability.js

JavaScript
1
star
23

baconsacktd

1
star
24

go-dot

Dot rendering using braille characters in Go
Go
1
star
25

gar-example

An example application designed to use the gar Go application archiver
Go
1
star
26

rbasic

BASIC interpreter written in Rust
Rust
1
star
27

transmitter-api

API to fetch transmitter data, including location and frequency
Ruby
1
star
28

annscraper

PHP
1
star
29

tourney

PHP
1
star
30

issue-gantt

Ruby
1
star
31

termui-rich-widget

A rich text widget for termui supporting text formatting and input
Go
1
star
32

go-under-cover

Tunnel network traffic through secure websockets
Go
1
star
33

cardy

Cardy is a flashcard server with a bundled jQuery Mobile client.
JavaScript
1
star
34

moodle_quiz_scraper

Ruby
1
star
35

vim_config

My personal vim configuration
Vim Script
1
star
36

design-wok

Connecting businesses with designers
Ruby
1
star
37

gantt.js

CoffeeScript
1
star
38

percy-android

Percy client for Android.
Java
1
star
39

mysql-glb

Benchmark MySQL by replaying a general log
Go
1
star
40

coo

Static web builder, with a vast range of supported languages
CoffeeScript
1
star
41

ez-commerce

Ruby
1
star
42

symbolic_media_library

PHP
1
star
43

pargo

Parser combinator library for Go
Go
1
star
44

spawtz-indoor-cricket-scraper

Go
1
star