Changed dropzone - url WiP.

This commit is contained in:
Naida Vatric
2020-03-11 22:32:10 +01:00
parent 5066c2fa70
commit a7148ba6c3
9 changed files with 179 additions and 174 deletions

View File

@@ -61,14 +61,13 @@ setInterval(checkUpNotify, 1000 * 60 * 60 * 24);
const PROJECT_ID = "marketalarm";
const KEY_FILENAME = ""; //relative path
const BUCKET_NAME = "marketalarm-photos";
//Tried implicitly creating with env credentials and direktcly as here
const storage = new Storage();
const bucket = storage.bucket(BUCKET_NAME);
app.get("/generateSignedURL", (req, res) => {
async function generateSignedUrl() {
console.log("Started server function!");
// console.log("Started server function!");
const options = {
//Tried to define Google ID and private key while debugging
@@ -79,12 +78,12 @@ app.get("/generateSignedURL", (req, res) => {
};
const filename = req.query.filename;
console.log("Filename: ", filename);
console.log("Bucket name:", bucket.name);
// console.log("Filename: ", filename);
// console.log("Bucket name:", bucket.name);
const [url] = await bucket.file(filename).getSignedUrl(options);
console.log(`The signed url is ${url}.`);
//console.log(`The signed url is ${url}.`);
res.status(200).send(url);
}