serve icon indicating copy to clipboard operation
serve copied to clipboard

Update getFilePath for SPA support

Open kevinfiol opened this issue 4 years ago • 2 comments

Hi there!

This is a great and tiny project. I began using this in conjunction with esbuild for a couple projects.

I was surprised to learn that Single-Page App support wasn't included. I forked your repo and added this for myself., but would like to see if you'd like to have it upstream. Feedback welcome.

With these changes, if you wanted to serve an SPA, you would need to add a fallback property to the options object you pass to serve.start. In the case of SPAs, you'd probably want the fallback to be index.html. So:

serve.start({
    port: 7000,
    root: '.',
    live: true,
    fallback: 'index.html'
});

EDIT: For the record, I did see and test #1 but was confused by the PR description and personally, that solution did not work in my project.

kevinfiol avatar Nov 19 '21 06:11 kevinfiol

I have the same issue and was looking for a way to do this in code. (I searched for fallback and found this pr.)

CapsAdmin avatar Feb 04 '22 08:02 CapsAdmin

@CapsAdmin Just a heads up: I've since created a fork of servor that ditches auto-reload in favor of manual-reload, similar to nativew/serve. I'm using this on projects now in place of nativew/serve.

kevinfiol avatar Feb 04 '22 16:02 kevinfiol