modify cors setting
This commit is contained in:
parent
f328453df4
commit
21ca3831e7
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
node_modules
|
19
index.js
19
index.js
@ -2,15 +2,15 @@
|
|||||||
* Favicon Grabber
|
* Favicon Grabber
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express')
|
||||||
const cors = require('cors')
|
const cors = require('cors')
|
||||||
|
|
||||||
const routers = {
|
const routers = {
|
||||||
api: require('./api/router'),
|
api: require('./api/router')
|
||||||
};
|
}
|
||||||
|
|
||||||
const server = express();
|
const server = express()
|
||||||
const NODE_PORT = parseInt(process.env.NODE_PORT, 10);
|
const NODE_PORT = parseInt(process.env.NODE_PORT, 10)
|
||||||
|
|
||||||
server.get('/', (req, res) => {
|
server.get('/', (req, res) => {
|
||||||
res.send('ok')
|
res.send('ok')
|
||||||
@ -19,10 +19,11 @@ server.get('/', (req, res) => {
|
|||||||
server.use(cors({
|
server.use(cors({
|
||||||
origin: (origin, cb) => {
|
origin: (origin, cb) => {
|
||||||
cb(null, !!origin)
|
cb(null, !!origin)
|
||||||
}
|
},
|
||||||
|
credentials: true
|
||||||
}))
|
}))
|
||||||
server.use('/api', routers.api);
|
server.use('/api', routers.api)
|
||||||
|
|
||||||
server.listen(NODE_PORT, () => {
|
server.listen(NODE_PORT, () => {
|
||||||
console.log(`Server listening on port ${NODE_PORT} in ${process.env.NODE_ENV} mode...`);
|
console.log(`Server listening on port ${NODE_PORT} in ${process.env.NODE_ENV} mode...`)
|
||||||
});
|
})
|
||||||
|
1606
package-lock.json
generated
1606
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -24,5 +24,8 @@
|
|||||||
"markdown-it-prism": "^1.1.1",
|
"markdown-it-prism": "^1.1.1",
|
||||||
"normalize-url": "^2.0.1",
|
"normalize-url": "^2.0.1",
|
||||||
"request": "^2.81.0"
|
"request": "^2.81.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"standard": "^12.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user