Skip to content
This repository was archived by the owner on Dec 7, 2021. It is now read-only.

Commit 5447357

Browse files
authored
feat: add web server for login support
1 parent 90577ca commit 5447357

22 files changed

+8344
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
# misc
2121
.DS_Store
22+
.env
2223
.env.local
2324
.env.development.local
2425
.env.test.local
@@ -37,3 +38,8 @@ secrets.sh
3738
# complexity reports
3839
es6-src/
3940
report/
41+
42+
# VoTT Server
43+
server/lib
44+
server/node_modules
45+
server/coverage

package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"buffer-reverse": "^1.0.1",
2424
"crypto-js": "^3.1.9-1",
2525
"dotenv": "^7.0.0",
26+
"express-request-id": "^1.4.1",
2627
"google-protobuf": "^3.6.1",
2728
"jpeg-js": "^0.3.4",
2829
"json2csv": "^4.5.0",

server/.env.template

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
APP_ID=xyz
2+
APP_SECRET=asdf
3+
COOKIE_SECRETS="[ { key: '12345678901234567890123456789012', iv: '123456789012' }, { key: 'abcdefghijklmnopqrstuvwxyzabcdef', iv: 'abcdefghijkl' }, ])"
4+
ALLOW_HTTP=true
5+
BASE_URL=http://localhost:3000/

server/.vscode/launch.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Launch via NPM",
11+
"runtimeExecutable": "npm",
12+
"runtimeArgs": [
13+
"run-script",
14+
"debug"
15+
],
16+
"port": 9229
17+
},
18+
{
19+
"type": "node",
20+
"request": "launch",
21+
"name": "Launch Program",
22+
"program": "${workspaceFolder}/lib/app.js", //"${workspaceFolder}\\lib\\app.js",
23+
"args": [
24+
"|",
25+
"bunyan"
26+
],
27+
"outFiles": [
28+
"${workspaceFolder}/**/*.js"
29+
],
30+
"console": "internalConsole",
31+
"outputCapture": "std",
32+
}
33+
34+
]
35+
}

server/.vscode/tasks.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "build",
9+
"problemMatcher": [
10+
"$tsc"
11+
],
12+
"group": "build"
13+
},
14+
{
15+
"type": "typescript",
16+
"tsconfig": "tsconfig.json",
17+
"option": "watch",
18+
"problemMatcher": [
19+
"$tsc-watch"
20+
],
21+
"group": "build"
22+
}
23+
]
24+
}

server/azure-deploy.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Node.js
2+
# Build a general Node.js project with npm.
3+
# Add steps that analyze code, save build artifacts, deploy, and more:
4+
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
5+
6+
trigger:
7+
- johnshew/login
8+
9+
variables:
10+
# Azure Resource Manager connection created during pipeline creation
11+
azureSubscription: 'fe7b93fe-e836-4a55-804c-883dbea6af24'
12+
13+
# Web app name
14+
webAppName: 'vott'
15+
16+
# Agent VM image name
17+
vmImageName: 'ubuntu-latest'
18+
19+
stages:
20+
- stage: Build
21+
displayName: Build stage
22+
jobs:
23+
- job: Build
24+
displayName: Build
25+
pool:
26+
vmImage: $(vmImageName)
27+
28+
steps:
29+
- task: NodeTool@0
30+
inputs:
31+
versionSpec: '10.x'
32+
displayName: 'Install Node.js'
33+
34+
- script: |
35+
npm install
36+
npm run build --if-present
37+
# npm run test --if-present
38+
workingDirectory: $(System.DefaultWorkingDirectory)/server
39+
displayName: 'npm install, build and test'
40+
41+
- task: ArchiveFiles@2
42+
displayName: 'Archive files'
43+
inputs:
44+
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/server'
45+
includeRootFolder: false
46+
archiveType: zip
47+
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
48+
replaceExistingArchive: true
49+
50+
- upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
51+
artifact: drop
52+
53+
- stage: Deploy
54+
displayName: Deploy stage
55+
dependsOn: Build
56+
condition: succeeded()
57+
jobs:
58+
- deployment: Deploy
59+
displayName: Deploy
60+
environment: 'development'
61+
pool:
62+
vmImage: $(vmImageName)
63+
strategy:
64+
runOnce:
65+
deploy:
66+
steps:
67+
- task: AzureWebApp@1
68+
displayName: 'Azure Web App Deploy: vott'
69+
inputs:
70+
azureSubscription: $(azureSubscription)
71+
appType: webAppLinux
72+
appName: $(webAppName)
73+
runtimeStack: 'NODE|10.10'
74+
package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip
75+
startUpCommand: 'npm run start'

server/jest.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
rootDir: "src",
5+
coverageDirectory: "../coverage",
6+
};

0 commit comments

Comments
 (0)