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

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.

主站蜘蛛池模板: 通许县| 永寿县| 林芝县| 合山市| 大余县| 毕节市| 岑溪市| 偏关县| 永丰县| 梧州市| 武山县| 玛沁县| 章丘市| 兖州市| 政和县| 桂阳县| 林口县| 娱乐| 金堂县| 青州市| 石景山区| 青州市| 樟树市| 安顺市| 绥芬河市| 达州市| 西乌珠穆沁旗| 维西| 新建县| 工布江达县| 灵丘县| 湘潭市| 桃园县| 梧州市| 泸定县| 抚顺市| 青海省| 江川县| 平原县| 尉犁县| 华亭县|