KiritoAxinity commited on
Commit
33ec7b2
·
verified ·
1 Parent(s): 4e84cce

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +7 -4
index.js CHANGED
@@ -1,6 +1,7 @@
1
  var express = require('express')
2
- var proxy = require('http-proxy-middleware')
3
-
 
4
  var app = express()
5
 
6
  let port = process.env.PORT;
@@ -8,10 +9,12 @@ if (port == null || port == "") {
8
  port = 8000;
9
  }
10
 
11
- app.use('/api', proxy({
 
12
  target: 'https://www.sakugabooru.com',
13
  changeOrigin: true,
14
  pathRewrite: {'^/api' : ''}
15
  }))
 
16
  app.use('/', express.static('public'))
17
- app.listen(port)
 
1
  var express = require('express')
2
+ // Change this line to use the named export
3
+ const { createProxyMiddleware } = require('http-proxy-middleware')
4
+
5
  var app = express()
6
 
7
  let port = process.env.PORT;
 
9
  port = 8000;
10
  }
11
 
12
+ // Change 'proxy' to 'createProxyMiddleware' here
13
+ app.use('/api', createProxyMiddleware({
14
  target: 'https://www.sakugabooru.com',
15
  changeOrigin: true,
16
  pathRewrite: {'^/api' : ''}
17
  }))
18
+
19
  app.use('/', express.static('public'))
20
+ app.listen(port)