fictional-fiesta
Summary
A proof of concept HTML Form Builder created using Golang, GraphQL, and MongoDB
Build With
Getting Started
Setup MongoDB Database
- make sure you have docker installed
- run
echo "MONGO_DB_URL=mongodb://root:example@0.0.0.0:27017/\n DATABASE_NAME=forms" > .env
- run
docker compose up -d to start mongodb server locally
Running the Project
- run
go get to install modules
- run
go run main.go to start the project
- run
curl http://localhost:8080/
- You should received
{ "status": "ok" }
Examples
All examples use the localhost environment for testing. They demonstrate variables, queries, and mutations.
Basic Fetching
Query
query filterForms($id: String!, $page: Int, $limit: Int) {
list(id: $id, page: $page, limit: $limit) {
count,
results {
id,
fieldsets {
fields {
ordinal,
name,
type,
}
legend,
}
}
}
}
Variables
{
"id": "68b99132f30dfb2ed5aed633"
}
mutation
mutation createForm($name: String!, $active: Boolean!, $fieldsets: FieldSetInput) {
create(name: $name, active: $active, fieldset: $fieldsets) {
id
}
}
Variables
{
"active": true,
"fieldsets": {
"inputs": [
{
"label": "First Name",
"multiple": false,
"required": true,
"type": "text"
},
{
"label": "Last Name",
"multiple": false,
"required": true,
"type": "text"
}
],
"label": "Basic Contact"
},
"name": "A name that you want this form to be"
}