favicon-server/index.js

30 lines
535 B
JavaScript
Raw Normal View History

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