An API that has all the CRUD protocols that you need predefined! You can create data clusters and operate CRUD protocols on these clusters using the power of API calls.
- Node
- Nodemon. If you dont have it, run
$ npm i -g nodemon
- MongoDB, running on
mongodb://127.0.0.1:27017/
$ npm i
$ node initdb.js
$ npm start
Use the react-formgen
ReactJS package to populate the form view on the front end.
Use the react-tablegen
ReactJS package to populate the table view for submission entries.
Make a POST
request to http://localhost:4000
with a similar schema below, to create a form.
{
"name": "Sign up",
"slug": "sign-up",
"meta": {},
"structure": [
{
"key": "first_name",
"label": "First name",
"type": "text"
},
{
"key": "last_name",
"type": "text",
"label": "last name"
},
{
"key": "check",
"type":"checkbox",
"label": "Checkbox test"
},
{
"key": "list",
"type":"dropdown",
"label": "This is a dropdown",
"options": [
{
"label": "hello",
"value": "no"
}
]
},
{
"key": "submit",
"type": "submit",
"placeholder": "Submit",
"className": "waves-effect waves-light btn"
}
]
}
Once the request is made, you will receive a formId hash in a payload as this.
{
"formId": "xxxxxxxxxxxxxxxxx"
}
Make a GET
request to http://localhost:4000/forms/<formId>
to retreive the form that you have created.
Make a PUT
request to http://localhost:4000/forms/<formId>
with a json body payload using a schema similar as to one for creating a form.
Make a DELETE
request to http://localhost:4000/forms/<formId>
and the form will be deleted.
Make a POST
request to http://localhost:4000/submissions/<formId>
, the body payload will be passed into the databas, as is.
Make a GET
request to http://localhost:4000/submissions/<formId>
to retreive all submissions made to the form.
Make a PUT
request to http://localhost:4000/submissions/<submission_ID>
with a json body payload, and the submission will be replaced with the body payload.
Make a DELETE
request to http://localhost:4000/submissions/<submission_ID>
and the submisssion will be deleted.