Skip to content

jeffjadulco/hn

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 

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