Real estate input clean up.

This commit is contained in:
Naida Vatric
2020-03-09 23:30:37 +01:00
parent 96bc66ef7b
commit 5f674230e1
10 changed files with 182 additions and 186 deletions

View File

@@ -58,33 +58,28 @@ setInterval(crawl, CRAWLER_INTERVAL * 1000);
setInterval(checkUpNotify, 1000 * 60 * 60 * 24);
//Google storage req
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
version: "v2", //tried v4 also
version: "v2",
action: "write",
contentType: "image/*", //tried without and with specific image/png ex.
contentType: "image/*",
expires: Date.now() + 86400000
};
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);
}