Usage Examples
Next

NextJS

import axios from 'axios';
 
export async function getServerSideProps() {
  let ipos = [];
 
  try {
    const response = await axios.get('https://api.ipoalerts.in/ipos?status=open', {
      headers: {
        'x-api-key': 'your_api_key_here'
      }
    });
    ipos = response.data.ipos;
  } catch (error) {
    console.error('Error fetching IPO data:', error);
  }
 
  return { props: { ipos } };
}
 
const IpoList = ({ ipos }) => (
  <div>
    <h1>IPO List</h1>
    <ul>
      {ipos.map(ipo => (
        <li key={ipo.id}>{ipo.name}</li>
      ))}
    </ul>
  </div>
);
 
export default IpoList;