Code improvements
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
const puppeteer = require('puppeteer');
|
||||
const { PuppeteerBlocker } = require('@cliqz/adblocker-puppeteer');
|
||||
const fetch = require('cross-fetch');
|
||||
const config = require('../../src/config.json');
|
||||
const config = require('../../src/config.js');
|
||||
const fs = require('fs');
|
||||
|
||||
const screenshotDirectory = config.api.storage_location + '/Webmarker/screenshot\'s/';
|
||||
const pdfDirectory = config.api.storage_location + '/Webmarker/pdf\'s/';
|
||||
const screenshotDirectory = config.API.STORAGE_LOCATION + '/Webmarker/screenshot\'s/';
|
||||
const pdfDirectory = config.API.STORAGE_LOCATION + '/Webmarker/pdf\'s/';
|
||||
|
||||
if (!fs.existsSync(screenshotDirectory)){
|
||||
fs.mkdirSync(screenshotDirectory, { recursive: true });
|
||||
@@ -32,4 +32,4 @@ module.exports = async (link, id) => {
|
||||
await browser.close();
|
||||
|
||||
return title;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -2,14 +2,14 @@ const express = require('express');
|
||||
const app = express();
|
||||
const { MongoClient } = require('mongodb');
|
||||
const cors = require('cors');
|
||||
const config = require('../src/config.json');
|
||||
const config = require('../src/config.js');
|
||||
const getData = require('./modules/getData.js')
|
||||
|
||||
const port = config.api.port;
|
||||
const port = config.API.PORT;
|
||||
|
||||
const URI = config.api.mongodb_URI;
|
||||
const database = config.api.database_name;
|
||||
const collection = config.api.collection_name;
|
||||
const URI = config.API.MONGODB_URI;
|
||||
const database = config.API.DB_NAME;
|
||||
const collection = config.API.COLLECTION_NAME;
|
||||
|
||||
const client = new MongoClient(URI);
|
||||
|
||||
@@ -88,4 +88,4 @@ async function deleteDoc(doc) {
|
||||
app.listen(port, () => {
|
||||
console.log(`Success! running on port ${port}.`);
|
||||
client.connect();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user