Business Address Search

const express = require('express'); const fetch = require('node-fetch'); const app = express(); const API_KEY = ' 52454349-d583-4d60-b754-14eafa602de7'; app.get('/search', async (req, res) => { const postcode = req.query.postcode; try { const response = await fetch(`https://api.company-information.service.gov.uk/search/companies?postcode=${postcode}`, { headers: { Authorization: `Basic ${Buffer.from(API_KEY + ':').toString('base64')}`, }, }); if (response.ok) { const data = await response.json(); res.json(data.items); } else { const errorData = await response.json(); res.status(response.status).json({ error: errorData }); } } catch (error) { console.error('Error:', error); res.status(500).json({ error: 'Internal Server Error' }); } }); const PORT = process.env.PORT || 3000; app.listen(PORT, () => { console.log(`Server is running on port ${PORT}`); });
0
Skip to Content
TM Energy
TM Energy
Home
English
Contact Us
TM Energy
TM Energy
Home
English
Contact Us
Home
English
Back
Contact Us

info@tmenergy.co.uk
0203 488 94 43

7 Bell Yard, London, WC2A 2JR

Privacy Policy