i have file server works on rpi 2 raspian , have been trying migrate newer rpi3 jesse. every time try run following error stack
/media/pi/demoserver.js:82 server.listen(port, () => { ^ syntaxerror: unexpected token ) @ module._compile (module.js:439:25) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.js:312:12) @ function.module.runmain (module.js:497:10) @ startup (node.js:119:16) @ node.js:906:3
any suggestions on why occurring? there subtle nuance between 2 distributions should address?
here code server (with omissions).
const express = require('express'); const formidable = require('formidable'); const fs = require('fs-extra'); const http = require('http'); const util = require('util'); const serveindex = require('serve-index'); const servestatic = require('serve-static'); const path = require('path'); const server = express(); const port = process.env.port || 1001; const dirtoserve = '/media/pi/shared'; function setheaders(res, filepath) { res.setheader('content-disposition', 'attachment; filename=' + path.basename(filepath)); } server.post('/media/pi/shared', function(req,res) { }); //serve static folder , index of folder server.use('/', serveindex(dirtoserve, { icond: true })); server.use('/', servestatic(dirtoserve, {setheaders: setheaders })); server.listen(port, () => { console.log('listening on port ' + port); });
Comments
Post a Comment