@ossy/app 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,21 @@
1
1
  export function ProxyInternal() {
2
2
  return (req, res, next) => {
3
+ console.log(`[@ossy/app][proxy] ${req.method} ${req.originalUrl}`)
3
4
 
4
5
  if (!req.originalUrl.startsWith('/@ossy')) {
5
6
  return next()
6
7
  }
7
-
8
+
8
9
  const domain = process.env.OSSY_API_URL || 'https://api.ossy.se'
9
10
  const url = `${domain}${req.path}`
10
11
  const headers = JSON.parse(JSON.stringify(req.headers)) // Clone headers
11
- const workspaceId = headers.workspaceId || config.workspaceId
12
+ const workspaceId = headers.workspaceId
12
13
 
13
14
  if (workspaceId) {
14
15
  headers['workspaceid'] = workspaceId
15
16
  }
17
+
18
+ console.log(`[@ossy/app][proxy] workspaceId ${workspaceId}`)
16
19
 
17
20
  const request = {
18
21
  method: req.method,
@@ -38,6 +41,7 @@ export function ProxyInternal() {
38
41
  res.json("")
39
42
  })
40
43
  .catch((error) => {
44
+ console.log(`[@ossy/app][proxy][error]`, error)
41
45
  const status = error.status
42
46
  res.status(status || 500)
43
47
  res.json({ message: error.message || 'Internal Server Error' })
package/cli/server.js CHANGED
@@ -23,10 +23,10 @@ if (Middleware !== undefined) {
23
23
 
24
24
  const middleware = [
25
25
  morgan('tiny'),
26
- express.static(ROOT_PATH),
27
26
  express.json({ strict: false }),
27
+ ...(Middleware || []),
28
+ express.static(ROOT_PATH),
28
29
  ProxyInternal(),
29
- ...(Middleware || [])
30
30
  ]
31
31
 
32
32
  app.use(middleware)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ossy/app",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "",
5
5
  "source": "./src/index.js",
6
6
  "main": "./src/index.js",
@@ -57,5 +57,5 @@
57
57
  "/cli",
58
58
  "README.md"
59
59
  ],
60
- "gitHead": "71269efebe05376c2ead8a2a81a94ddf098996c6"
60
+ "gitHead": "5f4a87bf04d3116391c3468fa01096bce1d8a9f1"
61
61
  }