Serving Static Assets

When using the term static asset, we refer to all of those nondynamic files, such as images, fonts, icons, compiled CSS, and JS files.

The easiest way to serve those assets is by using the default /public folder provided by Next.js. In fact, every file inside this folder will be considered and served as a static asset. A new file called index.txt is created and put inside the /public folder:

Click the “Run” button below to execute the code. Once it has finished execution, you can view the output using the link provided.

Get hands-on with 1200+ tech skills courses.