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

support for static content / html middleware? #8

Open
ericjang opened this issue Aug 29, 2013 · 6 comments
Open

support for static content / html middleware? #8

ericjang opened this issue Aug 29, 2013 · 6 comments

Comments

@ericjang
Copy link

Hello,

Do you plan on having support for serving html pages + other static content? Or is that something to be implemented in a separate Middleware Module?

@zachallaun
Copy link
Contributor

Hi Eric,

This should be easily implemented as a piece of middleware, and as such probably belongs in Meddle.jl. It could be used from Morsel like so to serve assets in a folder called assets from the url prefix /static.

using Morsel
import Meddle: StaticAssetService

app = Morsel.app()

namespace(app, "/static", StaticAssetService("assets"))

start(app, PORT)

Pull requests welcome! (We'll probably get to this eventually anyways, though.)

@despeset
Copy link
Contributor

This middleware already exists in Meddle actually! It is called FileServer - see https://github.com/hackerschool/Meddle.jl/blob/master/src/Meddle.jl#L132-L150

@zachallaun
Copy link
Contributor

Well there you go! This goes to show how bad our public documentation is ;). We're working on fixing this!

@despeset
Copy link
Contributor

That said, we should test this with Morsel as @zachallaun outlined above - reopening as an integration test / documentation issue.

@despeset despeset reopened this Aug 29, 2013
@ericjang
Copy link
Author

gr8, thanks very much

On Thu, Aug 29, 2013 at 10:58 AM, Daniel Mendel [email protected]:

That said, we should test this with Morsel as Zach outlined above -
reopening as an integration test / documentation issue.


Reply to this email directly or view it on GitHubhttps://github.com//issues/8#issuecomment-23509427
.

@odow
Copy link

odow commented Mar 3, 2015

This is basically a follow up to the issue above (sorry if this is a dumb question):

When you create a Morsel app is it possible to specifiy additional middleware (such as FileServer) without modifying the hard coded stack in the start function of Morsel.jl (https://github.com/JuliaWeb/Morsel.jl/blob/master/src/Morsel.jl#L216)?

There is a function that seems like it does exactly this (https://github.com/JuliaWeb/Morsel.jl/blob/master/src/Morsel.jl#L99-L111) but I am not sure what the thunk function should be...

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