में सीएसएस और जे एस की सेवा कर रहा GoLang ट्यूटोरियल here पालन किया, लेकिन जो भी कारण मैं मुसीबत हो रहा है CSS और JS सेवा करने के लिए एप्लिकेशन प्राप्त करने के लिए। यदि मैं जाने के बिना अपना स्थिर पृष्ठ चलाता हूं तो पेज सीएसएस ठीक काम करता है। जब मैं दूसरी तरफ जाने वाला सर्वर चलाता हूं तो सीएसएस बस काम नहीं करता है।मैं कैसे जाओ लैंग
<link rel="stylesheet" href="../assets/css/bootstrap.min.css">
<link rel="stylesheet" href="../assets/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="../assets/css/custom.css">
.
.
.
then under the body tag
<script src="../assets/js/jquery.min.js"></script>
<script src="../assets/js/bootstrap.min.js"></script>
.
.
.
मेरे फ़ाइल पेड़ इस
कैसे मैं अपने जाने आवेदन मिलता है जैसा दिखता है:
यहाँ मेरी एचटीएमएल तरह की तरह लग रहा है क्या है मुझे आवश्यक सीएसएस और जावास्क्रिप्ट की सेवा है?
समस्या के बाद से हल किया गया है, यहाँ मुख्य काम कर रहा है:
func main() {
http.HandleFunc("/view/", makeHandler(viewHandler))
http.HandleFunc("/edit/", makeHandler(editHandler))
http.HandleFunc("/save/", makeHandler(saveHandler))
http.HandleFunc("/index/", makeHandler(indexHandler))
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
http.ListenAndServe(":8080", nil)
}
यहाँ संचालकों का एक उदाहरण मैं
func indexHandler(w http.ResponseWriter, r *http.Request, title string) {
p := &Page{Title: title}
err := templates.ExecuteTemplate(w, "index.html", p)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}
संभावित डुप्लिकेट [गो टेम्पलेट में जेएस फ़ाइल शामिल करें] (http://stackoverflow.com/questions/28899675/include-js-file-in-go-template/28899786#28899786); और [golang वेबसर्वर जहां फाइल सिस्टम पर वेबसाइट नक्शे की जड़ करता है के साथ?] (http://stackoverflow.com/questions/28745161/with-golang-webserver-where-does-the-root-of-the-website -मैप-ऑन-द-फाइल सिस्टम/28745280 # 28745280) – icza