diff --git a/backend/db.js b/backend/db.js index 9117a17..776b68f 100644 --- a/backend/db.js +++ b/backend/db.js @@ -1,5 +1,5 @@ const Sequelize = require("sequelize"); -const sequelize = new Sequelize("sql7274844", "sql7274844", "upMgevlgak", { +const sequelize = new Sequelize("sql7276322", "sql7276322", "RS53ihYlg9", { host: "sql7.freemysqlhosting.net", dialect: "mysql", operatorsAliases: false diff --git a/backend/index.js b/backend/index.js index 19befc8..6345cc6 100644 --- a/backend/index.js +++ b/backend/index.js @@ -12,7 +12,7 @@ app.use(bodyParser.urlencoded({ extended: true })); const port = process.env.PORT || 5000; -app.get("/api/sendnotifications", async function(req, res) { +app.get("/sendnotifications", async function(req, res) { let marketAlerts = await MarketAlert.findAll(); let lastDateUpdate = await Promise.all( @@ -33,7 +33,7 @@ app.get("/api/sendnotifications", async function(req, res) { ); }); -app.get("/api/:url", async (req, res) => { +app.get("/items/:url", async (req, res) => { let url = "https://www.olx.ba/pretraga?" + req.params.url + @@ -45,7 +45,7 @@ app.get("/api/:url", async (req, res) => { }); }); -app.post("/api/marketalerts", function(req, res) { +app.post("/marketalerts", function(req, res) { const { email, last_date, olx_url } = req.body; sequelize.sync().then(() => MarketAlert.create({ diff --git a/frontend-react/src/components/App.js b/frontend-react/src/components/App.js index 63f2bd0..aece1e6 100644 --- a/frontend-react/src/components/App.js +++ b/frontend-react/src/components/App.js @@ -49,7 +49,7 @@ class App extends React.Component { onUserDataChange({ info: "olx_url", value: url }); if (url) { axios - .get(`/api/${url}`) + .get(`/items/${url}`) .then(response => { onItemsChanged(response.data.items); onUserDataChange({ diff --git a/frontend-react/src/components/NotificationModal.js b/frontend-react/src/components/NotificationModal.js index ae55d61..a7b39ab 100644 --- a/frontend-react/src/components/NotificationModal.js +++ b/frontend-react/src/components/NotificationModal.js @@ -57,7 +57,7 @@ class NotificationModal extends React.Component { userdata: { email, last_date, olx_url } } = this.props; axios - .post("/api/marketalerts", { + .post("/marketalerts", { email, last_date, olx_url @@ -138,7 +138,12 @@ class NotificationModal extends React.Component { {validEmail ? ( - + ) : (