Proxy http-server in Webpack dev mode - #100
Merged
Merged
Conversation
http-server in Webpack dev mode
Borewit
marked this pull request as draft
July 19, 2025 08:55
Borewit
force-pushed
the
proxy-server-in-dev-mode
branch
from
July 19, 2025 09:11
90e670a to
2368ac0
Compare
Borewit
marked this pull request as ready for review
July 19, 2025 09:11
Borewit
force-pushed
the
proxy-server-in-dev-mode
branch
from
July 19, 2025 10:46
2368ac0 to
add1ca9
Compare
Borewit
force-pushed
the
proxy-server-in-dev-mode
branch
from
July 19, 2025 13:13
add1ca9 to
bbd9f38
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This extends the Webpack development mode to be able to access the HTTP server backend.
Follow up of:
This requires to start both:
npm start, accessible via http://localhost:8080/npm dev, accessible via http://localhost:9000/graph TD %% Nodes User[/"User Browser<br>localhost:9000"/] WebpackDevServer["Webpack Dev Server<br>localhost:9000"] HttpServer["http-server<br>localhost:8080"] MusicFile[["song.mp3<br>in ./music folder"]] %% Relationships User -->|Requests /| WebpackDevServer User -->|Requests /music/song.mp3| WebpackDevServer WebpackDevServer -->|Proxies /music/*| HttpServer HttpServer -->|Reads| MusicFile %% Styling style User fill:#e3f2fd,stroke:#2196f3,stroke-width:2px style MusicFile fill:#fff3e0,stroke:#ff9800,stroke-width:2pxFuture Considerations
While http-server is excellent for quickly serving static files to a browser, it is not intended to function as a backend API for web applications. It responds with HTML directory listings and lacks support for structured responses like JSON, which are essential when building RESTful services or programmatic file access. If your application needs to interact with the server via JavaScript (e.g., fetch or AJAX) and expects machine-readable data (e.g., JSON), a more suitable approach is to use a lightweight Node.js server (e.g., with Express or Fastify) that can explicitly serve both static files and JSON-based endpoints.
Note
Follow up:
http-serverwithfastify#101