Fork me on GitHub
#lein-figwheel
<
2016-02-22
>
Lambda/Sierra15:02:47

When using Figwheel + Devcards at the same time as your own application HTTP server, does it matter if you serve static assets from your app's HTTP server or from Figwheel's embedded HTTP server?

grzm16:02:09

I'm attempting to port the om-next-starter project (https://github.com/jdubie/om-next-starter) to use stuartsierra's component library following the example in https://github.com/bhauman/lein-figwheel#user-content-scripting-with-component . Here's a gist: https://gist.github.com/grzm/f0caa09e5b15500a4b89

grzm16:02:41

Figwheel starts up on 3449, serving up the om app. The jetty-server starts up on 3000. And the om app get's 404's when fetching data from the server.

grzm16:02:25

I'm likely missing something quite basic. Any pointers would be appreciated.

Lambda/Sierra16:02:10

@grzm Which port are you visiting in your web browser?

Lambda/Sierra16:02:34

Try visiting 3000 instead.

Lambda/Sierra16:02:09

If your application is trying to fetch data from the server, it needs to get it from your application server, not Figwheel.

Lambda/Sierra16:02:31

Which, interestingly, answers the question I just asked earlier.

grzm16:02:40

I thought they might be related simple_smile

grzm16:02:38

3000 gives me a 404 as well. It doesn't serve the app at all.

Lambda/Sierra16:02:45

Is your app server configured to serve static files out of resources/public?

grzm16:02:19

Running the server using just :figwheel-options {:ring-handler server/app} works as expected. index.html, which loads the app, is in resources/public, which I understand is the default for ring. There's no explicit config for resources/public in :app-server. Should there be?

grzm16:02:06

you don't happen to know how to configure that, do you? simple_smile My google fu is failing me.

Lambda/Sierra16:02:47

Depends on your web framework / routing library / etc.

grzm16:02:03

okay, in that case I believe I do have that configured. It's using ring, and the handler includes (wrap-resource req "public") middleware

grzm16:02:03

oh, crikey. I was visiting , not .

grzm16:02:00

thanks for walking me through it.

Lambda/Sierra16:02:08

You're welcome.