Use fs-extra in index.
This commit is contained in:
parent
5611ea338a
commit
69ccdc58c1
16
index.js
16
index.js
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
const restify = require('restify')
|
const restify = require('restify')
|
||||||
const log = require('./lib/log')('main')
|
const log = require('./lib/log')('main')
|
||||||
const fs = require('fs')
|
const { readFile } = require('fs-extra')
|
||||||
const { exec } = require('child_process')
|
const { exec } = require('child_process')
|
||||||
|
|
||||||
const BLE = require('./lib/ble')
|
const BLE = require('./lib/ble')
|
||||||
|
@ -584,13 +584,13 @@ function bRestart (obj, cb) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function index (req, res, next) {
|
function index (req, res, next) {
|
||||||
fs.readFile(INDEXPATH, 'utf8', (err, data) => {
|
let data
|
||||||
if (err) {
|
|
||||||
return next(err)
|
try {
|
||||||
}
|
data = await readFile(INDEXPATH, 'utf8')
|
||||||
res.end(data)
|
} catch (err) {
|
||||||
next()
|
return next(err)
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function init () {
|
function init () {
|
||||||
|
|
Loading…
Reference in New Issue