Skip to content
/ webawk Public

simple (mock) web server framework written in awk

License

Notifications You must be signed in to change notification settings

Syuparn/webawk

Repository files navigation

webawk

MIT License Test

simple (mock) web server framework written in awk

What's this?

Webawk is a simple JSON API server framework for awk. This helps to make dummy-response server by only awk one-line command.

$ ./webawk.sh 'GET("/names") { b["names"][1]="Taro"; res(200, b) }'
$ curl localhost:8080/names
{"names":["Taro"]}

Requirement

  • GNU awk (5.x.x+)
    • should be installed as gawk
  • jq
    • because I have not written a JSON parser yet 😏

Image

Or you can run webawk docker image.

$ docker run -it -p 8080:8080 ghcr.io/syuparn/webawk:0.4.2 'GET("/names") { b["names"][1]="Taro"; res(200, b) }'

See https://github.com/users/Syuparn/packages/container/package/webawk for detail.

Usage

See ./examples for practical examples. You can also check command options by ./webawk.sh -h.

-f progfile : run program file instead of program string
-h          : get help
-n          : how many requests it can handle (default: 2147483647)
-p port     : port to listen (default: 8080)
-c command  : which awk command to run (default: gawk)

Example:
  webawk.sh 'GET("/names") {b["names"][1]="Taro"; res(200, b)}'

For developers

# test
$ ./test.sh

About

simple (mock) web server framework written in awk

Resources

License

Stars

Watchers

Forks

Packages