update upload function
This commit is contained in:
67
server.js
67
server.js
@ -16,28 +16,57 @@ app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
app.use(cors(corsOptions));
|
||||
|
||||
function callInitFileMover(re) {
|
||||
function callLoadInitializeData(projectid, construction_id, username, sheetname, filename){
|
||||
https.get('https://natnats.mobilous.com/loadInitializeData?projectid=23&construction_id=1&username=1&sheetname=dataSheet&filename=ini_データ入力シート.xlsx', (resp) => {
|
||||
let data = '';
|
||||
|
||||
https.get('https://natnats.mobilous.com/iniFileMover', (resp) => {
|
||||
let data = '';
|
||||
// A chunk of data has been received.
|
||||
resp.on('data', (chunk) => {
|
||||
data += chunk;
|
||||
});
|
||||
|
||||
// A chunk of data has been received.
|
||||
resp.on('data', (chunk) => {
|
||||
data += chunk;
|
||||
});
|
||||
|
||||
// The whole response has been received. Print out the result.
|
||||
resp.on('end', () => {
|
||||
if(data !== 'no match'){
|
||||
resdata = JSON.parse(data);
|
||||
console.log(resdata);
|
||||
}
|
||||
// The whole response has been received. Print out the result.
|
||||
resp.on('end', () => {
|
||||
if(data !== 'no match'){
|
||||
|
||||
});
|
||||
resdata = JSON.parse(data);
|
||||
console.log(resdata);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}).on("error", (err) => {
|
||||
console.log("Error: " + err.message);
|
||||
});
|
||||
}).on("error", (err) => {
|
||||
console.log("Error: " + err.message);
|
||||
});
|
||||
}
|
||||
|
||||
function callInitFileMover(re) {
|
||||
https.get('https://natnats.mobilous.com/iniFileMover', (resp) => {
|
||||
let data = '';
|
||||
|
||||
// A chunk of data has been received.
|
||||
resp.on('data', (chunk) => {
|
||||
//debug
|
||||
data = "{
|
||||
"construction_id": 3,
|
||||
"file_name": "ini_データ入力シート.xlsx",
|
||||
"file_type": "dataSheet"
|
||||
}"
|
||||
data += chunk;
|
||||
});
|
||||
|
||||
// The whole response has been received. Print out the result.
|
||||
resp.on('end', () => {
|
||||
if(data !== 'no match'){
|
||||
resdata = JSON.parse(data);
|
||||
console.log(resdata);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}).on("error", (err) => {
|
||||
console.log("Error: " + err.message);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@ -55,6 +84,8 @@ var upload = multer({ storage: storage }).single('file')
|
||||
|
||||
app.post('/upload', function(req, res, next) {
|
||||
|
||||
console.log(req.body.email);
|
||||
|
||||
upload(req, res, function(err) {
|
||||
if (err instanceof multer.MulterError) {
|
||||
return res.status(500).json(err)
|
||||
|
||||
Reference in New Issue
Block a user