aboutsummaryrefslogtreecommitdiff
path: root/vnext/server/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/server/index.js')
-rw-r--r--vnext/server/index.js43
1 files changed, 1 insertions, 42 deletions
diff --git a/vnext/server/index.js b/vnext/server/index.js
index 692fbd76..bbb5a578 100644
--- a/vnext/server/index.js
+++ b/vnext/server/index.js
@@ -1,55 +1,14 @@
-import express from 'express'
-import { raw } from 'body-parser'
-import cors from 'cors'
-import config from 'config'
import debug from 'debug'
const log = debug('http')
-import serverRenderer from './middleware/renderer'
-import event from './middleware/event'
-import oembed from './middleware/oembed'
-import urlExpand from './middleware/urlexpand'
-import releases from './middleware/android'
+import { app } from './app'
const PORT = process.env.LISTEN_PORT || 8081
-import path from 'path'
-import { webhook, webhookPath } from './durov'
-
-// initialize the application and create the routes
-const app = express()
-app.use(raw())
-app.use(cors())
-const router = express.Router()
-
-router.post('/api/v2/sender', event)
-router.get('/api/v2/oembed', oembed)
-router.get('/api/v2/urlexpand', urlExpand)
-router.get('/api/apps/android/releases', releases)
-
-const durov_webhook = webhookPath()
-if (durov_webhook) {
- router.post(`/api/v2/${durov_webhook}`, webhook)
-}
-router.use('^/$', serverRenderer)
-
-const STATIC_ROOT = config.get('service.static_root') || path.resolve(__dirname, 'public')
-
-// other static resources should just be served as they are
-router.use(express.static(
- STATIC_ROOT,
- { maxAge: '30d' },
-))
-
-router.use('*', serverRenderer)
-
-app.use(router)
-
// start the app
app.listen(PORT, (error) => {
if (error) {
return console.log('something bad happened', error)
}
-
log('listening on ' + PORT + '...')
})