Real estate input clean up.
This commit is contained in:
17
index.js
17
index.js
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user