Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is sirv-cli an alternative to http-server? #4

Closed
rauschma opened this issue May 15, 2018 · 6 comments
Closed

Is sirv-cli an alternative to http-server? #4

rauschma opened this issue May 15, 2018 · 6 comments

Comments

@rauschma
Copy link

If so – mention in the readme?

@lukeed
Copy link
Owner

lukeed commented May 15, 2018

Hey, yes it is. However there are a few dozen alternatives in this space, so how do you recommend I approach amending the readme without listing all of them? 😅 Genuinely asking

@developit
Copy link
Contributor

developit commented May 29, 2018

Might work to just include it in the benchmark comparisons, that'd at least have it turn up in GH/Google searches.

@andymans
Copy link

Suggestion: Many SPAs deployed on CDN now put a 404.html (incl the same js as index.html) in the public dir. The idea is that if YOU visit a link shared by ME, the 404.html will be served and the client-side router will take care of the correct application-level routing. Would be great if sirv took care of this i.e. if a 404.html exists, then serve it, otherwise respond as now with a default 404 response status.

@lukeed
Copy link
Owner

lukeed commented Nov 2, 2018

Hey @andymans, if you're using sirv-cli you can achieve a similar setup with the --single flag. It will serve your index.html on no match, as opposed to your 404.html suggestion.

This is because most client-side apps will have their own 404 handler once mounted, so sirv-cli just aims to hand-off the request so that your app can take over.

If you need more control than this, you can use sirv (the middleware) and play with the onNoMatch option. If you look at the CLI code, you will see that that is exactly what it has done.

@andymans
Copy link

andymans commented Nov 2, 2018

Fantastic! Just what I was looking for. I hadn't spotted the --single flag. Thx.

@lukeed lukeed closed this as completed in 17ea37f Dec 29, 2021
@lukeed
Copy link
Owner

lukeed commented Dec 29, 2021

Finally got around to adding benchmark comparison to http-server here

Compact view:

Req/Sec
http-server (cache) 5,247
http-server (no cache) 5,091
sirv-cli (cache) 12,612
sirv-cli (no cache) 8,490
sirv-cli (cache, no logs) 13,609
sirv-cli (no cache, no logs) 10,157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants