susee
This commit is contained in:
parent
64e4a5f661
commit
ec8ed85210
@ -1141,4 +1141,21 @@ const storage = new Storage({ keyFilename : path.join(__dirname, "../../googleCl
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
exports.test = async (req, res) => {
|
||||
const storage = new Storage({ keyFilename : path.join(__dirname, "../../googleCloud.json") });
|
||||
bucketName = 'pd-giene-data';
|
||||
const bucket = storage.bucket(bucketName);
|
||||
|
||||
try {
|
||||
const [files] = await bucket.getFiles();
|
||||
|
||||
const fileNames = files.map((file) => file.name);
|
||||
console.log('File names:', fileNames);
|
||||
res.send({'data':fileNames})
|
||||
} catch (error) {
|
||||
console.error('Error retrieving file names:', error);
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ module.exports = app => {
|
||||
* description: success
|
||||
*/
|
||||
router.get("/demo", Mycontroller.Welcome);
|
||||
|
||||
router.get("/test", SalesPdController.test);
|
||||
// landing page api
|
||||
/**
|
||||
* @swagger
|
||||
|
||||
Loading…
Reference in New Issue
Block a user