Home

Awesome

🗃 Forma

Data Collector as a Service — your personal server for HTML forms.

Build Template

Roadmap

Motivation

Quick start

Requirements:

$ make up demo status

     Name                    Command               State                          Ports
---------------------------------------------------------------------------------------------------------------
forma_db_1        docker-entrypoint.sh postgres    Up      0.0.0.0:5432->5432/tcp
forma_server_1    /bin/sh -c echo $BASIC_USE ...   Up      0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp
forma_service_1   service run --with-profili ...   Up      0.0.0.0:8080->80/tcp, 0.0.0.0:8090->8090/tcp,
                                                           0.0.0.0:8091->8091/tcp, 0.0.0.0:8092->8092/tcp

$ open http://127.0.0.1.xip.io/api/v1/10000000-2000-4000-8000-160000000004

$ make help
<details> <summary><strong>GET curl /api/v1/UUID</strong></summary>
$ curl http://127.0.0.1.xip.io/api/v1/10000000-2000-4000-8000-160000000004
# <form id="10000000-2000-4000-8000-160000000004" lang="en" title="Email Subscription"
#       action="http://localhost/api/v1/10000000-2000-4000-8000-160000000004" method="POST"
#       enctype="application/x-www-form-urlencoded">
#       <input id="10000000-2000-4000-8000-160000000004_email" name="email" type="email" title="Email"
#              maxlength="64" required="true"></input>
#       <input type="submit">
# </form>
</details> <details> <summary><strong>POST /api/v1/UUID</strong></summary>
$ curl -v -H "Content-Type: application/x-www-form-urlencoded" \
       --data-urlencode "email=test@my.email" \
       http://127.0.0.1.xip.io/api/v1/10000000-2000-4000-8000-160000000004
# > POST /api/v1/10000000-2000-4000-8000-160000000004 HTTP/1.1
# > Host: 127.0.0.1.xip.io
# > User-Agent: curl/7.54.0
# > Accept: */*
# > Content-Type: application/x-www-form-urlencoded
# > Content-Length: 21
# >
# < HTTP/1.1 302 Found
# < Location: http://localhost/api/v1/10000000-2000-4000-8000-160000000004#eyJpbnB1dCI6ImJmM2MyYWIwLWVkYjQtNDFiZi1iNDlkLWY3ZjNiMmI5ZDViMiIsImlkIjoiMTAwMDAwMDAtMjAwMC00MDAwLTgwMDAtMTYwMDAwMDAwMDA0IiwicmVzdWx0Ijoic3VjY2VzcyJ9
# < Date: Sat, 05 May 2018 09:34:47 GMT
# < Content-Length: 0
# <
</details>

Specification

API

You can find API specification here. Also, we recommend using Insomnia HTTP client to work with the API - you can import data for it from the file. Or you can choose Postman - its import data is here and here.

CLI

You can use CLI not only to start the HTTP server but also to execute CRUD operations.

<details> <summary><strong>Service command-line interface</strong></summary>
$ make install

$ form-api help
Forma

Usage:
  form-api [command]

Available Commands:
  completion  Print Bash or Zsh completion
  ctl         Forma Service Control
  help        Help about any command
  migrate     Apply database migration
  run         Start HTTP server
  version     Show application version

Flags:
  -h, --help   help for form-api

Use "form-api [command] --help" for more information about a command.
</details>

Bash and Zsh completions

You can find completion files here or build your own using these commands

$ form-api completion -f bash > /path/to/bash_completion.d/form-api.sh
$ form-api completion -f zsh  > /path/to/zsh-completions/_form-api.zsh

Installation

Brew

$ brew install kamilsk/tap/form-api

Binary

$ export REQ_VER=2.0.0  # all available versions are on https://github.com/kamilsk/form-api/releases/
$ export REQ_OS=Linux   # macOS and Windows are also available
$ export REQ_ARCH=64bit # 32bit is also available
# wget -q -O forma.tar.gz
$ curl -sL -o forma.tar.gz \
       https://github.com/kamilsk/form-api/releases/download/"${REQ_VER}/form-api_${REQ_VER}_${REQ_OS}-${REQ_ARCH}".tar.gz
$ tar xf forma.tar.gz -C "${GOPATH}"/bin/ && rm forma.tar.gz

Docker Hub

$ docker pull kamilsk/form-api:2.x
# or use mirror
$ docker pull quay.io/kamilsk/form-api:2.x

From source code

$ egg github.com/kamilsk/form-api@^2.0.0 -- make test install
# or use mirror
$ egg bitbucket.org/kamilsk/form-api@^2.0.0 -- make test install

egg<sup id="anchor-egg">1</sup> is an extended go get.

<sup id="egg">1</sup> The project is still in prototyping.


made with ❤️ for everyone