官术网_书友最值得收藏!

Serving static files over HTTP

While designing web applications, it’s always a best practice to serve static resources, such as .js, .css, and images from the filesystem, or any content delivery network (CDN), such as Akamai or Amazon CloudFront, rather than serving it from the web server. This is because all these types of files are static and do not need to be processed; so why should we put extra load on the server? Moreover, it helps to boost application performance, as all the requests for the static files will be served from external sources and therefore reduce the load on the server.

Go's net/http package is sufficient enough for serving static resources from the filesystem through FileServer, which we will be covering in this recipe.

主站蜘蛛池模板: 汪清县| 杭州市| 石楼县| 凌源市| 开远市| 泗水县| 台安县| 香河县| 巴南区| 鱼台县| 凌云县| 积石山| 临海市| 太白县| 兴文县| 西乌珠穆沁旗| 乌兰浩特市| 雅安市| 屏东市| 阳泉市| 江源县| 孟津县| 北海市| 镇沅| 德清县| 三河市| 松江区| 陈巴尔虎旗| 平顶山市| 普宁市| 鄂温| 兰坪| 和林格尔县| 仙游县| 绩溪县| 珲春市| 襄汾县| 库尔勒市| 海淀区| 西贡区| 伊金霍洛旗|