fastify / fastify/fastify-nextjs

Does the fastify-nextjs public folder not work as designed by NextJS?

Open
#725 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
558
Forks
62
Avg merge
2d 4h
Merged PRs (30d)
6

Description

### Prerequisites

- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the issue has not already been raised

### Issue

Maybe I am misinterpreting how this all comes together, but I am using the `fastify-nextjs` plugin to serve pages from the `/src/pages` folder... Example: `/src/pages/payment-options.js` with a route defined like so:

```
await app.register(fastifyNextJs).after(async () => {
await app.next('/payment-options');
});
```

That route works fine... That said, I tried creating a `public` folder at the root of my project as is allowed by NextJS for serving static assets (html, css, js, text, images, etc) and I cannot access the URL via a web browser.

created file:
`/public/styles.css`

Tried to access via browser at `http://localhost/styles.css` and I get the standard fastify route doesn't exist 404 error...

`{"message":"Route GET:/styles.css not found","error":"Not Found","statusCode":404}` in the browser.

Does the `fastify-nextjs` not allow the nextjs `public` folder to work like it does in a normal nextjs setup?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.