Condos is a promise-based Node.js library for the Condos.ca api.
Install condos
and save to your package.json
in one easy step.
With npm:
npm install condos --save
With yarn:
yarn add condos
You may find the Condos documentation here.
- Import Condos into your application:
import Condos from 'condos';
- Call an api method to request data:
With Promises:
import Condos, {
Precision,
GroupType,
OfferType,
NeighbourhoodTorontoDowntown,
NeighbourhoodTorontoEastEnd,
SublocalityToronto
} from 'condos';
Condos.listings({
precision: Precision.Normal,
neighbourhood: [
NeighbourhoodTorontoDowntown.KingWest,
NeighbourhoodTorontoEastEnd.EastEndDanforth,
],
sublocality: [SublocalityToronto.Etobicoke],
groupBy: GroupType.Neighbourhood,
offer: OfferType.Sale,
}).then(data => {
console.log(data);
});
With async/await:
import Condos, {
Precision,
GroupType,
OfferType,
NeighbourhoodTorontoDowntown,
NeighbourhoodTorontoEastEnd,
SublocalityToronto
} from 'condos';
(async () => {
const data = await Condos.listings({
precision: Precision.Normal,
neighbourhood: [
NeighbourhoodTorontoDowntown.KingWest,
NeighbourhoodTorontoEastEnd.EastEndDanforth,
],
sublocality: [SublocalityToronto.Etobicoke],
groupBy: GroupType.Neighbourhood,
offer: OfferType.Sale,
});
console.log(data);
})();