sveltejs / sveltejs/kit

[feat] chaining SvelteKit apps

Open
#3,363 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pkg:adapter-node
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

The ssr middleware outputted by adapter-node is not a proper middleware because it never calls next(), making it impossible to compose it with other middlewares.

Describe the proposed solution

I'll submit a PR that'll introduce a new build option, handle404?: boolean:

  • when set to true (or undefined), handler will handle 404 errors and display a custom error page
  • when set to false, handler will call the next middleware on 404
Alternatives considered

Make handler a pure middleware, and handle 404 in index.js, after handler:

https://github.com/sveltejs/kit/blob/668b0aaa2b5626e8f610f395ac551f98eafbd10b/packages/adapter-node/src/index.js#L11-L16

It represents a significant amount of work but allows small performance improvements when using only handler.

Importance

i cannot use SvelteKit without it

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the adapter-node SSR middleware and the referenced packages/adapter-node/src/index.js entry point. Trace how handler currently handles 404 responses and how middleware composition would work. Done means the new handle404 option has the proposed default and false behavior, with tests covering both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.