@@ -69,17 +69,20 @@ func New(
69
69
if fileSystemPathToFile1JSON == nil {
70
70
fileSystemPathToFile1JSON = http.Dir(".")
71
71
}
72
+ fileSystemPathToFile1JSON = appendPrefix(fileSystemPathToFile1JSON, "/path/to")
72
73
if fileSystemPathToFile2JSON == nil {
73
74
fileSystemPathToFile2JSON = http.Dir(".")
74
75
}
76
+ fileSystemPathToFile2JSON = appendPrefix(fileSystemPathToFile2JSON, "/path/to")
75
77
if fileSystemPathToFile3JSON == nil {
76
78
fileSystemPathToFile3JSON = http.Dir(".")
77
79
}
80
+ fileSystemPathToFile3JSON = appendPrefix(fileSystemPathToFile3JSON, "/path/to")
78
81
return &Server{
79
82
Mounts: []*MountPoint{
80
- {"/path/to/file1.json", "GET", "/server_file_server/file1.json"},
81
- {"/path/to/file2.json", "GET", "/server_file_server/file2.json"},
82
- {"/path/to/file3.json", "GET", "/server_file_server/file3.json"},
83
+ {"Serve /path/to/file1.json", "GET", "/server_file_server/file1.json"},
84
+ {"Serve /path/to/file2.json", "GET", "/server_file_server/file2.json"},
85
+ {"Serve /path/to/file3.json", "GET", "/server_file_server/file3.json"},
83
86
},
84
87
PathToFile1JSON: http.FileServer(fileSystemPathToFile1JSON),
85
88
PathToFile2JSON: http.FileServer(fileSystemPathToFile2JSON),
@@ -107,15 +110,17 @@ func New(
107
110
if fileSystemPathToFile1JSON == nil {
108
111
fileSystemPathToFile1JSON = http.Dir(".")
109
112
}
113
+ fileSystemPathToFile1JSON = appendPrefix(fileSystemPathToFile1JSON, "/path/to")
110
114
if fileSystemPathToFile2JSON == nil {
111
115
fileSystemPathToFile2JSON = http.Dir(".")
112
116
}
117
+ fileSystemPathToFile2JSON = appendPrefix(fileSystemPathToFile2JSON, "/path/to")
113
118
return &Server{
114
119
Mounts: []*MountPoint{
115
120
{"MethodMixed1", "GET", "/resources1/{id}"},
116
121
{"MethodMixed2", "GET", "/resources2/{id}"},
117
- {"/path/to/file1.json", "GET", "/file1.json"},
118
- {"/path/to/file2.json", "GET", "/file2.json"},
122
+ {"Serve /path/to/file1.json", "GET", "/file1.json"},
123
+ {"Serve /path/to/file2.json", "GET", "/file2.json"},
119
124
},
120
125
MethodMixed1: NewMethodMixed1Handler(e.MethodMixed1, mux, decoder, encoder, errhandler, formatter),
121
126
MethodMixed2: NewMethodMixed2Handler(e.MethodMixed2, mux, decoder, encoder, errhandler, formatter),
@@ -179,10 +184,10 @@ func New(
179
184
180
185
var ServerMultipleFilesConstructorCode = `// Mount configures the mux to serve the ServiceFileServer endpoints.
181
186
func Mount(mux goahttp.Muxer, h *Server) {
182
- MountPathToFileJSON(mux, goahttp.Replace("", "/path/to/file.json", h.PathToFileJSON) )
183
- MountPathToFileJSON2(mux, goahttp.Replace("", "/path/to/file.json", h.PathToFileJSON2) )
187
+ MountPathToFileJSON(mux, h.PathToFileJSON)
188
+ MountPathToFileJSON2(mux, h.PathToFileJSON2)
184
189
MountFileJSON(mux, h.FileJSON)
185
- MountPathToFolder(mux, goahttp.Replace("/", "/path/to/folder", h.PathToFolder) )
190
+ MountPathToFolder(mux, h.PathToFolder)
186
191
}
187
192
188
193
// Mount configures the mux to serve the ServiceFileServer endpoints.
@@ -193,10 +198,10 @@ func (s *Server) Mount(mux goahttp.Muxer) {
193
198
194
199
var ServerMultipleFilesWithPrefixPathConstructorCode = `// Mount configures the mux to serve the ServiceFileServer endpoints.
195
200
func Mount(mux goahttp.Muxer, h *Server) {
196
- MountPathToFileJSON(mux, goahttp.Replace("", "/path/to/file.json ", h.PathToFileJSON))
197
- MountPathToFileJSON2(mux, goahttp.Replace("", "/path/to/file.json", h.PathToFileJSON2) )
198
- MountFileJSON(mux, goahttp.Replace("", "/file.json ", h.FileJSON))
199
- MountPathToFolder(mux, goahttp.Replace ("/server_file_server", "/path/to/folder ", h.PathToFolder))
201
+ MountPathToFileJSON(mux, http.StripPrefix("/server_file_server ", h.PathToFileJSON))
202
+ MountPathToFileJSON2(mux, h.PathToFileJSON2)
203
+ MountFileJSON(mux, http.StripPrefix("/server_file_server ", h.FileJSON))
204
+ MountPathToFolder(mux, http.StripPrefix ("/server_file_server", h.PathToFolder))
200
205
}
201
206
202
207
// Mount configures the mux to serve the ServiceFileServer endpoints.
@@ -210,9 +215,9 @@ func Mount(mux goahttp.Muxer, h *Server) {
210
215
MountPathToFileJSON(mux, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
211
216
http.Redirect(w, r, "/redirect/dest", http.StatusMovedPermanently)
212
217
}))
213
- MountPathToFileJSON2(mux, goahttp.Replace("", "/path/to/file.json", h.PathToFileJSON2) )
218
+ MountPathToFileJSON2(mux, h.PathToFileJSON2)
214
219
MountFileJSON(mux, h.FileJSON)
215
- MountPathToFolder(mux, goahttp.Replace("/", "/path/to/folder", h.PathToFolder) )
220
+ MountPathToFolder(mux, h.PathToFolder)
216
221
}
217
222
218
223
// Mount configures the mux to serve the ServiceFileServer endpoints.
0 commit comments