Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c42c60e

Browse files
author
tsv2013
committed
First commit
0 parents commit c42c60e

32 files changed

+9676
-0
lines changed

‎.gitignore‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
*.pid.lock
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage
19+
20+
# nyc test coverage
21+
.nyc_output
22+
23+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+
.grunt
25+
26+
# Bower dependency directory (https://bower.io/)
27+
bower_components
28+
29+
# node-waf configuration
30+
.lock-wscript
31+
32+
# Compiled binary addons (http://nodejs.org/api/addons.html)
33+
build/Release
34+
35+
# Dependency directories
36+
node_modules/
37+
jspm_packages/
38+
39+
# Typescript v1 declaration files
40+
typings/
41+
42+
# Optional npm cache directory
43+
.npm
44+
45+
# Optional eslint cache
46+
.eslintcache
47+
48+
# Optional REPL history
49+
.node_repl_history
50+
51+
# Output of 'npm pack'
52+
*.tgz
53+
54+
# Yarn Integrity file
55+
.yarn-integrity
56+
57+
# dotenv environment variables file
58+
.env
59+
60+
postgres/data

‎LICENSE‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://creativecommons.org/licenses/by-nc/3.0/

‎README.md‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# SurveyJS + NodeJS Demo Example
2+
3+
This demo shows how to integrate [SurveyJS](https://surveyjs.io/) components with a NodeJS backend.
4+
5+
[View Demo Online](https://surveyjs-nodejs.azurewebsites.net/)
6+
7+
## Disclaimer
8+
9+
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.
10+
11+
## Run the Application
12+
13+
Install [NodeJS](https://nodejs.org/) on your machine. After that, run the following commands:
14+
15+
```bash
16+
git clone https://github.com/surveyjs/surveyjs-nodejs.git
17+
cd surveyjs-nodejs
18+
npm i
19+
npm start
20+
```
21+
22+
Open http://localhost:3000 in your web browser.
23+
24+
## Client-Side App
25+
26+
The client-side part is the `surveyjs-react-client` React application. The current project includes only the application's build artifacts. Refer to the [surveyjs-react-client](https://github.com/surveyjs/surveyjs-react-client) repo for full code and information about the application.

‎compose.yml‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
version: '3'
2+
services:
3+
express-app:
4+
build:
5+
args:
6+
- NODE_ENV=development
7+
context: express-app
8+
target: development
9+
environment:
10+
- DATABASE_DB=surveyjs
11+
- DATABASE_USER=postgres
12+
- DATABASE_PASSWORD=/run/secrets/db-password
13+
- DATABASE_HOST=postgres
14+
- NODE_ENV=development
15+
ports:
16+
- 9080:3000
17+
secrets:
18+
- db-password
19+
volumes:
20+
- ./express-app:/code/express-app
21+
- ./public:/code/public
22+
networks:
23+
- surveyjs-net
24+
depends_on:
25+
- postgres
26+
postgres:
27+
build:
28+
context: postgres
29+
secrets:
30+
- db-password
31+
environment:
32+
POSTGRES_DB: "surveyjs"
33+
POSTGRES_USER: "postgres"
34+
# POSTGRES_PASSWORD: "123456"
35+
POSTGRES_PASSWORD_FILE: "/run/secrets/db-password"
36+
PGDATA: "/var/lib/postgresql/data/pgdata"
37+
volumes:
38+
- ./postgres/initdb:/docker-entrypoint-initdb.d
39+
- ./postgres/data:/var/lib/postgresql/data
40+
ports:
41+
- 9432:5432
42+
networks:
43+
- surveyjs-net
44+
healthcheck:
45+
test: ["CMD-SHELL", "pg_isready -U postgres -d public"]
46+
interval: 10s
47+
timeout: 5s
48+
retries: 5
49+
start_period: 10s
50+
restart: unless-stopped
51+
networks:
52+
surveyjs-net:
53+
driver: bridge
54+
secrets:
55+
db-password:
56+
file: ./postgres/password.txt

‎express-app/Dockerfile‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# syntax=docker/dockerfile:1.4
2+
FROM node:lts AS development
3+
4+
ARG NODE_ENV=production
5+
ENV NODE_ENV $NODE_ENV
6+
7+
WORKDIR /code
8+
9+
ARG PORT=3000
10+
ENV PORT $PORT
11+
EXPOSE $PORT
12+
13+
COPY ./package.json /code/package.json
14+
# RUN npm i
15+
COPY ../package-lock.json /code/package-lock.json
16+
RUN npm ci
17+
18+
CMD [ "node", "express-app/index.js" ]
19+
20+
FROM development as dev-envs
21+
RUN <<EOF
22+
apt-get update
23+
apt-get install -y --no-install-recommends git
24+
EOF
25+
26+
RUN <<EOF
27+
useradd -s /bin/bash -m vscode
28+
groupadd docker
29+
usermod -aG docker vscode
30+
EOF
31+
# install Docker tools (cli, buildx, compose)
32+
COPY --from=gloursdocker/docker / /

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /