Changeset 3 in code


Ignore:
Timestamp:
Oct 11, 2021, 1:30:16 PM (4 years ago)
Author:
dev
Message:

Serve files as-is for context "/f/"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/partage.go

    r2 r3  
    1616        rootdir  string
    1717        baseuri  string
     18        filectx  string
    1819        maxsize  int64
    1920}
     
    123124                }
    124125
    125                 resp := conf.baseuri + "/" + filepath.Base(tmp.Name())
     126                resp := conf.baseuri + conf.filectx + filepath.Base(tmp.Name())
    126127                w.Write([]byte(resp))
    127128
     
    151152        conf.rootdir = "./static"
    152153        conf.baseuri = "http://192.168.0.3:8080"
     154        conf.filectx = "/f/"
    153155
    154156        http.HandleFunc("/", parse)
     157        http.Handle(conf.filectx, http.StripPrefix(conf.filectx, http.FileServer(http.Dir(conf.filepath))))
    155158        http.ListenAndServe("0.0.0.0:8080", nil)
    156159}
Note: See TracChangeset for help on using the changeset viewer.