favicon-server/index.js
2019-08-06 14:50:54 +08:00

30 lines
535 B
JavaScript

/**
* Favicon Grabber
*/
const express = require('express')
const cors = require('cors')
const routers = {
api: require('./api/router')
}
const server = express()
const NODE_PORT = parseInt(process.env.NODE_PORT, 10)
server.get('/', (req, res) => {
res.send('ok')
})
server.use(cors({
origin: (origin, cb) => {
cb(null, !!origin)
},
credentials: true
}))
server.use('/api', routers.api)
server.listen(NODE_PORT, () => {
console.log(`Server listening on port ${NODE_PORT} in ${process.env.NODE_ENV} mode...`)
})