modify cors setting

This commit is contained in:
Jay 2019-08-06 14:50:54 +08:00
parent f328453df4
commit 21ca3831e7
4 changed files with 1614 additions and 15 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
node_modules

View File

@ -2,15 +2,15 @@
* Favicon Grabber
*/
const express = require('express');
const express = require('express')
const cors = require('cors')
const routers = {
api: require('./api/router'),
};
api: require('./api/router')
}
const server = express();
const NODE_PORT = parseInt(process.env.NODE_PORT, 10);
const server = express()
const NODE_PORT = parseInt(process.env.NODE_PORT, 10)
server.get('/', (req, res) => {
res.send('ok')
@ -19,10 +19,11 @@ server.get('/', (req, res) => {
server.use(cors({
origin: (origin, cb) => {
cb(null, !!origin)
}
},
credentials: true
}))
server.use('/api', routers.api);
server.use('/api', routers.api)
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

File diff suppressed because it is too large Load Diff

View File

@ -24,5 +24,8 @@
"markdown-it-prism": "^1.1.1",
"normalize-url": "^2.0.1",
"request": "^2.81.0"
},
"devDependencies": {
"standard": "^12.0.1"
}
}