-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
33 lines (26 loc) · 1.04 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
let express = require('express')
let cors = require('cors')
const ws = require('ws')
const http = require('http')
const verifyIdTokenMiddleware = require('./middlewares/verifyTokenMiddleware')
const handleCrawl = require('./src/handleCrawl')
// const handleQna = require('./src/handleQna')
const handleNavSearch = require('./src/handleNavSearch')
const onConnection = require('./src/onConnection')
const adminRouter = require('./routes/admin')
const widgetRouter = require('./routes/widget')
let app = express()
app.use(cors.apply({
origin:"*"
}))
app.use(express.json())
app.get("/",(req,res)=>res.send("Hello,World!"))
app.get('/api/v1/crawl', handleCrawl)
// app.get("/api/v1/qna",handleQna)
app.get("/api/v1/navsearch",handleNavSearch)
app.use('/api/v1/admin',adminRouter)
app.use('/api/v1/',widgetRouter)
const httpserver = http.createServer({},app)
const wsserver = new ws.Server({ server:httpserver });
httpserver.listen(process.env.PORT || 4000,() => console.log("Server at 4000"))
wsserver.on('connection',(conn,req)=>onConnection(wsserver,conn,req))