Spaces:
Sleeping
Sleeping
Update index.js
Browse files
index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
var express = require('express')
|
| 2 |
-
const path = require('path')
|
| 3 |
const { createProxyMiddleware } = require('http-proxy-middleware')
|
| 4 |
|
| 5 |
var app = express()
|
|
@@ -9,13 +9,15 @@ if (port == null || 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.listen(port, '0.0.0.0', () => {
|
| 20 |
console.log(`Server is running on port ${port}`);
|
| 21 |
});
|
|
|
|
| 1 |
var express = require('express')
|
| 2 |
+
const path = require('path')
|
| 3 |
const { createProxyMiddleware } = require('http-proxy-middleware')
|
| 4 |
|
| 5 |
var app = express()
|
|
|
|
| 9 |
port = 8000;
|
| 10 |
}
|
| 11 |
|
|
|
|
| 12 |
app.use('/api', createProxyMiddleware({
|
| 13 |
target: 'https://www.sakugabooru.com',
|
| 14 |
changeOrigin: true,
|
| 15 |
pathRewrite: {'^/api' : ''}
|
| 16 |
}))
|
| 17 |
|
| 18 |
+
// THIS IS THE MISSING PIECE:
|
| 19 |
+
app.use('/', express.static(path.join(__dirname, 'public')))
|
| 20 |
+
|
| 21 |
app.listen(port, '0.0.0.0', () => {
|
| 22 |
console.log(`Server is running on port ${port}`);
|
| 23 |
});
|