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

StaticMiddleware() is not working #25

Closed
yvasiyarov opened this issue Jul 5, 2014 · 2 comments
Closed

StaticMiddleware() is not working #25

yvasiyarov opened this issue Jul 5, 2014 · 2 comments

Comments

@yvasiyarov
Copy link

Hello,

I've created simple application:

package main

import (
    "github.com/gocraft/web"
    "net/http"
)
type Context struct{

}


func main() {
    router := web.New(Context{}).
        Middleware(web.LoggerMiddleware).
        Middleware(web.ShowErrorsMiddleware).
        Middleware(web.StaticMiddleware("public"))
    http.ListenAndServe("localhost:8080", router)
}

in the same folder I have "public" directory with "index.html" file inside.
If I make "http://localhost:8080/index.html" request, I got "404 page not found"
any idea why ?

@andrioid
Copy link

Have you tried "./public" and made sure that your "public" directory is in the same directory as your main file? I ask because I made the mistake of having my main.go in a "bin/" directory and couldn't understand why static wasn't working. Obviously, I needed to ask for "../public" in that case.

@cypriss
Copy link
Member

cypriss commented Aug 30, 2014

@yvasiyarov lmk if andrioid's advice didn't help. This wfm.

@cypriss cypriss closed this as completed Aug 30, 2014
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

3 participants