choojs / choojs/choo

Usage with http-server

Open
#712 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
6.8k
Forks
573
PR merge metrics
No merged PRs in 30d

Description

### Expected behavior

from my package.json

"start": "http-server -o -c-1 -p 8080 --proxy http://localhost:8080/ ",

This indeed loads up the app properly at `http://127.0.0.1:8080/`
However

```js
function joinView(state, emit) {
return html`

Join!


`;
}
function lobby(state, emit) {
return html`

Lobby


Join

`;
}
app.use(devtools());
app.use((state) => {
state.logger = false;
});
app.route("/join", joinView);
app.route("/", lobby);
app.mount("body");
```

If i click the link "Join" from within the app, the router properly pushStates to /join and renders the joinView
but **if I reload so that the browser tries to request /join**... i run into a loop because I'm trying to force http-server to do a catchall and serve my index.html which just has a simple div.

```html




```

What precisely should I do to handle navigating directly to /join? Without the proxy statement /join doesn't exist because its not really something available outside the SPA.
@YerkoPalma

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.