Question:
Has anyone had any experience integrating real estate listings on Wix Editor?
Product:
Wix Editor
What are you trying to achieve:
I have a client who is a real estate agent and they want to list all of their RETS/MLS listings on their website.
What have you already tried:
I have access to all of the XML data but I’m not sure how to turn that into HTML to be able to showcase on the website.
Additional information:
I have all of the necessary XML code to install it, I’m just not sure how to convert it to html or where to apply the correct information/codes for the backend so that the front end can pull it from the backend connection.
Specifically, I need help with the 3 steps below, and the information below each step is the information I have to work with to accomplish it:
-
Install Required Node.js Package:
npm install express axios xml2js dotenv -
Create a .env File for Configuration:
RETS_USERNAME=ncr.rets.568000990_VVM
RETS_PASSWORD=bL)6Ls-)9h
RETS_ENDPOINT=https://retsgw.flexmls.com/rets2_3/Login RETS_SEARCH_URL=https://retsgw.flexmls.com/rets2_3/Search -
Create the Back-End Code (server.js):
const express = require(‘express’);
const axios = require(‘axios’);
const xml2js = require(‘xml2js’);
require(‘dotenv’).config();
const app = express();
const port = 3000;
app.get(‘/api/listings’, async (req, res) => {
try {
const response = await axios({
method: ‘post’,
url: process.env.RETS_ENDPOINT,
auth: {
username: process.env.RETS_USERNAME,
password: process.env.RETS_PASSWORD,
},
headers: {
‘RETS-Version’: ‘RETS/1.7.2’,
‘User-Agent’: ‘RETS-Client/1.0’,
}
});
const sessionId = response.headers['set-cookie'][0].split(';')[0];
const listingsResponse = await axios({
method: 'get',
url: process.env.RETS_SEARCH_URL,
headers: {
'RETS-Version': 'RETS/1.7.2',
'User-Agent': 'RETS-Client/1.0',
'Cookie': sessionId,
},
params: {
SearchType: 'Property',
Class: 'RES',
Query: '(ListPrice=300000-600000)',
Format: 'COMPACT',
QueryType: 'DMQL2',
StandardNames: 0,
}
});
xml2js.parseString(listingsResponse.data, (err, result) => {
if (err) {
return res.status(500).json({ error: 'Failed to parse RETS response' });
}
res.json(result);
});
} catch (error) {
console.error(error);
res.status(500).json({ error: 'An error occurred while fetching listings' });
}
});
app.listen(port, () => {
console.log(Server running on http://localhost:${port}
);
});
I know this is probably a longshot, but I figured I’d reach out to see. Again, I don’t need anyone to code anything, I just need to know where to put the code.
Thank you!