make it possible for nginx to serve the tracks instead

This commit is contained in:
Evert Prants 2018-10-11 11:41:26 +03:00
parent 53cf8c5744
commit d46c3eaf20
Signed by: evert
GPG Key ID: 1688DA83D222D0B5

View File

@ -141,7 +141,7 @@ router.get('/serve/by-id/:id', async (req, res, next) => {
return res.download(fpath)
}
res.sendFile(fpath)
res.redirect('/file/track' + fpath.substring(values.directory.length))
})
router.use((err, req, res, next) => {
@ -150,6 +150,7 @@ router.use((err, req, res, next) => {
})
app.use('/api', router)
app.use('/file/track', express.static(path.resolve(values.directory)))
app.use('/', express.static(path.join(__dirname, 'public')))
app.listen(port, '127.0.0.1', function () {