Revert "Real estate input clean up."

This reverts commit 5f674230e1.
This commit is contained in:
Naida Vatric
2020-03-10 22:03:32 +01:00
parent 5f674230e1
commit 5066c2fa70
10 changed files with 186 additions and 182 deletions

View File

@@ -58,28 +58,33 @@ 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 = {
version: "v2",
//Tried to define Google ID and private key while debugging
version: "v2", //tried v4 also
action: "write",
contentType: "image/*",
contentType: "image/*", //tried without and with specific image/png ex.
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);
}