Skip to content

Uvacoder/hn-feeds

Repository files navigation

Hacker News reader using Next.js

License: MIT Twitter Follow

Demo GIF

Statically dynamic using ISR

With Next.js' Incremental Static Regeneration (ISR), dynamic content can be statically served. Existing pages can be updated once a request is made.

Inspired by Brian Lovin's work. Check it out here!

Development

First, run the development server:

npm run dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

Configuration

You can change the regeneration frequency by changing the revalidate value.

export async function getStaticProps(context) {
  const posts = await getPosts();
  const data = posts.filter(Boolean)

  return {
    props: {
      data,
    },
    revalidate: 3600,
  };
}

You can also change the number of posts displayed by passing an integer to getPosts.

Author

License

This project is open source and available under the MIT License