Add front server bodyparser (#971)

Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
Denis Bykhov 2022-02-08 20:34:19 +06:00 committed by GitHub
parent e7fb57d9fa
commit 9c9b2b46d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 19 deletions

View File

@ -144,6 +144,7 @@ specifiers:
'@types/xml2js': ~0.4.9
'@typescript-eslint/eslint-plugin': ^5.4.0
autoprefixer: ^10.2.6
body-parser: ~1.19.1
commander: ^8.1.0
compression-webpack-plugin: ~9.0.0
cors: ^2.8.5
@ -343,6 +344,7 @@ dependencies:
'@types/xml2js': 0.4.9
'@typescript-eslint/eslint-plugin': 5.7.0_eslint@7.32.0+typescript@4.5.4
autoprefixer: 10.4.0_postcss@8.4.5
body-parser: 1.19.1
commander: 8.3.0
compression-webpack-plugin: 9.0.1_webpack@5.65.0
cors: 2.8.5
@ -2054,7 +2056,7 @@ packages:
resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==}
dependencies:
'@types/connect': 3.4.35
'@types/node': 17.0.0
'@types/node': 17.0.10
dev: false
/@types/bonjour/3.5.10:
@ -2079,7 +2081,7 @@ packages:
/@types/connect/3.4.35:
resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==}
dependencies:
'@types/node': 17.0.0
'@types/node': 17.0.10
dev: false
/@types/content-disposition/0.5.4:
@ -11002,19 +11004,6 @@ packages:
optional: true
dev: false
/ws/8.3.0:
resolution: {integrity: sha512-Gs5EZtpqZzLvmIM59w4igITU57lrtYVFneaa434VROv4thzJyV6UjIL3D42lslWlI+D4KzLYnxSwtfuiO79sNw==}
engines: {node: '>=10.0.0'}
peerDependencies:
bufferutil: ^4.0.1
utf-8-validate: ^5.0.2
peerDependenciesMeta:
bufferutil:
optional: true
utf-8-validate:
optional: true
dev: false
/ws/8.4.2:
resolution: {integrity: sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA==}
engines: {node: '>=10.0.0'}
@ -11505,7 +11494,7 @@ packages:
eslint-plugin-promise: 5.2.0_eslint@7.32.0
prettier: 2.5.1
typescript: 4.5.4
ws: 8.3.0
ws: 8.4.2
transitivePeerDependencies:
- bufferutil
- supports-color
@ -11704,11 +11693,12 @@ packages:
dev: false
file:projects/front.tgz:
resolution: {integrity: sha512-RXsa4jlZB6UdPjSIAHmf07BEcWlH6N26QnAVFQ3QL5VdqLi73ohsPQV9seKz36c5jGsA//Z0BS9QYVCETuHdgA==, tarball: file:projects/front.tgz}
resolution: {integrity: sha512-/WdZzrPJRLdanV3e2pxKu4opGut1TLVFgFVo2/om5M995qLWu3lECdHHPMP5t+gl0iXfHMZPFSBxLFOIhceTRg==, tarball: file:projects/front.tgz}
name: '@rush-temp/front'
version: 0.0.0
dependencies:
'@rushstack/heft': 0.41.8
'@types/body-parser': 1.19.2
'@types/cors': 2.8.12
'@types/express': 4.17.13
'@types/express-fileupload': 1.2.0
@ -11718,6 +11708,7 @@ packages:
'@types/uuid': 8.3.3
'@typescript-eslint/eslint-plugin': 5.7.0_c25e8c1f4f4f7aaed27aa6f9ce042237
'@typescript-eslint/parser': 5.7.0_eslint@7.32.0+typescript@4.5.4
body-parser: 1.19.1
cors: 2.8.5
cross-env: 7.0.3
esbuild: 0.12.29

View File

@ -33,7 +33,8 @@
"esbuild": "^0.12.24",
"prettier": "^2.4.1",
"@rushstack/heft": "^0.41.1",
"typescript": "^4.3.5"
"typescript": "^4.3.5",
"@types/body-parser": "~1.19.2"
},
"dependencies": {
"@anticrm/core": "~0.6.11",
@ -47,6 +48,7 @@
"@anticrm/server-token": "~0.6.0",
"@anticrm/attachment": "~0.6.0",
"@anticrm/contrib": "~0.6.0",
"minio": "^7.0.19"
"minio": "^7.0.19",
"body-parser": "~1.19.1"
}
}

View File

@ -26,6 +26,7 @@ import https from 'https'
import { Client, ItemBucketMetadata } from 'minio'
import { join, resolve } from 'path'
import { v4 as uuid } from 'uuid'
import bp from 'body-parser'
async function minioUpload (minio: Client, workspace: string, file: UploadedFile): Promise<string> {
const id = uuid()
@ -48,6 +49,8 @@ export function start (config: { transactorEndpoint: string, elasticUrl: string,
app.use(cors())
app.use(fileUpload())
app.use(bp.json())
app.use(bp.urlencoded({ extended: true }))
// eslint-disable-next-line @typescript-eslint/no-misused-promises
app.get('/config.json', async (req, res) => {