5 ms·
There is no way to serve static files, mmmmm.
by adrianlmm 9y ago
There is no way to serve static files, mmmmm.
- dgfgfdagasdfgfa 9y agoAt best it'd be a stopgap before a reverse proxy or cache, though. For whom is this functionality a problem?
- jcstk 9y agoSure there is: http://aqueduct.io/docs/http/serving_files/ http://aqueduct.io/docs/http/serving_files/
- adrianlmm 9y agoNot convenient, you'll have to define a route for every single file instead of having a folder serving static content.
- jcstk 9y agoHmmm, no, that's not accurate. You specify a folder serving static content and the HTTP path is resolved against that folder. e.g. router.route("/*").pipe(new HTTPFileController("web/"); router.route("/files/*").pipe(new HTTPFileController("something_else/"); An HTTP request for /foo.html returns web/foo.html. An HTTP request for /foo/bar.html returns web/foo/bar.html. An HTTP request for /files/xyz.jpg returns the something_else/xyz.jpg. If the HTTP path is a directory, then index.html is automatically appended to it. This is a brief overview of the referenced documentation above.
- adrianlmm 9y agoYou still need to manually open the file, read it and add it to the body of the response, to impractical IMHO. Never mind, I was readding wrong.
- eat_veggies 9y agoIt's better to just serve those with nginx (or similar) isn't it?