Selaa lähdekoodia

added baths

master
Dunja Djokic 4 vuotta sitten
vanhempi
commit
24427f5be1
1 muutettua tiedostoa jossa 6 lisäystä ja 0 poistoa
  1. 6
    0
      app.js

+ 6
- 0
app.js Näytä tiedosto

@@ -129,6 +129,7 @@ app.post("/scrapes/", async (req, res) => {
const beds = req.body.beds;
const type = req.body.type;
const lifestyle = req.body.lifestyle;
const baths = req.body.baths;

// query builder
var query = `https://www.apartments.com`;
@@ -143,6 +144,10 @@ app.post("/scrapes/", async (req, res) => {
query += `/${beds}-bedrooms`;
}

if (baths) {
query += `${beds ? '-' : '/'}${baths}-bathrooms`;
}

if (price) {
if (beds) {
query += `-over-${price}`;
@@ -190,6 +195,7 @@ app.post("/scrapes/", async (req, res) => {
location: location,
description: description,
filters: [
{ name: 'baths', value: baths },
{ name: 'price', value: price },
{ name: 'beds', value: beds },
{ name: 'type', value: type },

Loading…
Peruuta
Tallenna