Skip to content

Instantly share code, notes, and snippets.

@intel352
Forked from okaq/godart.txt
Last active December 31, 2015 23:19
Show Gist options
  • Save intel352/8059344 to your computer and use it in GitHub Desktop.
Save intel352/8059344 to your computer and use it in GitHub Desktop.
import 'dart:html' show Console;
void main() {
var console = new Console();
console.log("ok ab dart!");
}
// to compile use:
// dart2js -oab.js ab.dart
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>okaq.com</title>
<script src="/js/ab.js"></script>
</head>
<body>
</body>
</html>
// webserver.go
package main
import (
"fmt"
"net/http"
// "net/url"
)
func AbHandler(w http.ResponseWriter, r *http.Request) {
fmt.Println(r.URL.Path)
if r.URL.Path == "/" {
http.ServeFile(w, r, "ab.html")
}
if r.URL.Path == "/js/ab.js" {
http.ServeFile(w, r, "ab.js")
}
}
func main() {
http.HandleFunc("/", AbHandler)
http.ListenAndServe(":8000", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment