Express / EJS based app

This commit is contained in:
Senad Uka
2019-03-23 05:08:21 +01:00
parent 2ceb6805ce
commit 0d7c154958
5 changed files with 10 additions and 4 deletions

View File

View File

View File

@@ -13,7 +13,7 @@ app.use(bodyParser.urlencoded({ extended: true }));
const port = process.env.PORT || 5000; const port = process.env.PORT || 5000;
app.get("/sendnotifications", async function(req, res) { app.get("/api/sendnotifications", async function(req, res) {
let marketAlerts = await MarketAlert.findAll(); let marketAlerts = await MarketAlert.findAll();
let lastDateUpdate = await Promise.all( let lastDateUpdate = await Promise.all(
@@ -34,7 +34,7 @@ app.get("/sendnotifications", async function(req, res) {
); );
}); });
app.get("/items/:url", async (req, res) => { app.get("/api/items/:url", async (req, res) => {
let url = let url =
"https://www.olx.ba/pretraga?" + "https://www.olx.ba/pretraga?" +
req.params.url + req.params.url +
@@ -46,7 +46,7 @@ app.get("/items/:url", async (req, res) => {
}); });
}); });
app.post("/marketalerts", function(req, res) { app.post("/api/marketalerts", function(req, res) {
const { email, last_date, olx_url } = req.body; const { email, last_date, olx_url } = req.body;
console.log(email, last_date, olx_url); console.log(email, last_date, olx_url);
sequelize.sync().then(() => { sequelize.sync().then(() => {
@@ -62,7 +62,7 @@ app.post("/marketalerts", function(req, res) {
}); });
}); });
app.post("/payforalert", function(request, response) { app.post("/api/payforalert", function(request, response) {
let tco = new Twocheckout({ let tco = new Twocheckout({
sellerId: "901402692", sellerId: "901402692",
privateKey: "A28DCE5F-9292-405C-8161-F84D8BB83AFC", privateKey: "A28DCE5F-9292-405C-8161-F84D8BB83AFC",

5
package-lock.json generated
View File

@@ -401,6 +401,11 @@
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
}, },
"ejs": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-2.6.1.tgz",
"integrity": "sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ=="
},
"encodeurl": { "encodeurl": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",

View File

@@ -22,6 +22,7 @@
"@sendgrid/mail": "^6.3.1", "@sendgrid/mail": "^6.3.1",
"aws-sdk": "^2.422.0", "aws-sdk": "^2.422.0",
"cheerio": "^1.0.0-rc.2", "cheerio": "^1.0.0-rc.2",
"ejs": "^2.6.1",
"express": "^4.16.4", "express": "^4.16.4",
"mysql2": "^1.6.4", "mysql2": "^1.6.4",
"node-fetch": "^2.3.0", "node-fetch": "^2.3.0",