Hey All,

I can't quite seem to get a fileserver working on a basic http server I am

The directory is as follows:

--- app.go (fileserver code)
--- js/
-- main.js
-- etc...
Basically the App and public folders are at the same level, and since the
app.go (fileserver) is in the App folder, to access the public folder
contents I use the following code (I assume):

http.Handle("/public/", http.FileServer(http.Dir("../public")))
http.ListenAndServe(":8080", nil)

The problem is that when I go to localhost:8080/public/js/main.js, I just
get a "404 Not Found".

Since the two folders are at the same level, I can't quite figure out what
the code should be to access the contents of public?

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 7 | next ›
Discussion Overview
groupgolang-nuts @
postedJul 26, '13 at 8:45a
activeJul 26, '13 at 9:56a



site design / logo © 2022 Grokbase