-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
40 lines (33 loc) · 850 Bytes
/
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
34
35
36
37
38
39
40
const express = require('express')
const app = express()
const cors = require('cors')
const logger = require('morgan')
const workerFarm = require('worker-farm')
require('dotenv').config()
app.use(cors())
app.use(logger('dev'))
const services = {
topCollections: workerFarm(
require.resolve('./src/v1/services/opensea/rankings/top.service')
),
trendingCollections: workerFarm(
require.resolve('./src/v1/services/opensea/rankings/trending.service')
)
}
services.topCollections('hello', (err) => {
if (err) console.log(err)
})
services.trendingCollections('hello', (err) => {
if (err) console.log(err)
})
app.use('/v1', require('./src/v1/routes'))
app.use('*', (req, res) => {
res.status(404).send({
statusCode: 404,
data: null,
error: {
message: '404 Not Found'
}
})
})
app.listen(process.env.PORT)