Static serve the image folder even when empty

This commit is contained in:
Rafael Taranto 2019-04-17 01:15:49 -03:00 committed by Josh Harvey
parent d3478fb2ba
commit 9a43bc4417

View file

@ -15,6 +15,7 @@ const helmet = require('helmet')
const WebSocket = require('ws')
const http = require('http')
const SocketIo = require('socket.io')
const makeDir = require('make-dir')
const _ = require('lodash/fp')
const machineLoader = require('../machine-loader')
@ -250,10 +251,12 @@ const certOptions = {
app.use(serveStatic(path.resolve(__dirname, '..', '..', 'public')))
if (fs.existsSync(idPhotoCardBasedir)) {
app.use('/id-card-photo', serveStatic(idPhotoCardBasedir, {index: false}))
if (!fs.existsSync(idPhotoCardBasedir)) {
makeDir.sync(idPhotoCardBasedir)
}
app.use('/id-card-photo', serveStatic(idPhotoCardBasedir, {index: false}))
function register (req, res, next) {
const otp = req.query.otp