- Notifications
You must be signed in to change notification settings - Fork6
This demo illustrates how easy it is to set up a client-server interaction of the SurveyJS client-side form builder component with any backend. By following the steps below you can run a sample React app with an integrated form builder. As a backend, the application uses NodeJS that stores form data in a PostgreSQL database.
License
surveyjs/surveyjs-nodejs-postgresql
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This demo shows how to integrateSurveyJS components with a NodeJS backend using a PostgreSQL database as a storage.
This demo must not be used as a real service as it doesn't cover such real-world survey service aspects as authentication, authorization, user management, access levels, and different security issues. These aspects are covered by backend-specific articles, forums, and documentation.
InstallNodeJS andDocker Desktop on your machine.
Run the following commands:
git clone https://github.com/surveyjs/surveyjs-nodejs-postgresql.gitcd surveyjs-nodejs-postgresqldocker compose up -dOpenhttp://localhost:9080 in your web browser.
The client-side part is thesurveyjs-react-client React application. The current project includes only the application's build artifacts in thepublic directory. Refer to thesurveyjs-react-client repo for full code and information about the application.
SurveyJS communicates with any database using JSON objects that contain either survey schemas or user responses. An SQL database should have two tables to store these objects:surveys andresults. You can use the following SQL script to create them:surveyjs.sql. The diagram below shows the structure of these tables:
To modify data in thesurveys andresults tables, you need to implement several JavaScript functions. According to the tasks they perform, these functions can be split into three modules:
SQL query builder
JS functions that construct CRUD SQL queries (see thesql-crud-adapter.jsfile).SQL query runner
JS functions that execute queries in an SQL database. The repository you are viewing includes a query runner for PostgreSQL databases (see thepostgres.jsfile). You can use it as an example to create a query runner for any other SQL database.Survey storage
JS functions that provide an API for working with survey schemas and user responses (see thesurvey-storage.jsfile). This API is used by the NodeJS application router (see theindex.jsfile).
These modules interact with each other as shown on the following diagram:
If you want to integrate SurveyJS with other databases, you can modify or replace the query builder and query runner without changing the survey storage module. This approach is applied to MongoDB integration in the following repository:surveyjs-nodejs-mongodb.
About
This demo illustrates how easy it is to set up a client-server interaction of the SurveyJS client-side form builder component with any backend. By following the steps below you can run a sample React app with an integrated form builder. As a backend, the application uses NodeJS that stores form data in a PostgreSQL database.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.

