From 5594b20e8d98ea508bd5ef0f765d953ed6daaca2 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Mon, 5 Jun 2017 20:21:06 +0200 Subject: [PATCH] Cleanup --- config.json | 2 +- images/icons/favicon.ico | Bin 0 -> 11119 bytes logger.go | 20 ++++++++++++++++++++ main.go | 19 +++++++++---------- 4 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 images/icons/favicon.ico create mode 100644 logger.go diff --git a/config.json b/config.json index e0a41926..48fd8390 100644 --- a/config.json +++ b/config.json @@ -33,7 +33,7 @@ "images/characters/arn-waifu.png" ], "manifest": { - "theme_color": "rgb(248, 165, 130)", + "theme_color": "#f8a582", "gcm_sender_id": "941298467524" }, "ports": { diff --git a/images/icons/favicon.ico b/images/icons/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..4d6a4cde6461651d7d1d1d9fc1f3451ccb6b7040 GIT binary patch literal 11119 zcmV-#E0ELx0096206;(h0096X09h*l02TlM0EtjeM-2)Z3IG5A4M|8uQUCw|KmY&$ zKnMl^0063Kaozv`AOJ~3K~#90y}EapRAth*eLp93?w%Z&0frfJ&QTH zUtQf-)qSe!si*1){tJ2hmOBQVao0`l#d=oACzFXgu25-;t{fPvT=Ld*ft0o!kuk|adkJw(=RqUls{Z_ z`7MqAjr~8Be{cN}WZ8qil|2i4Or3G*6&wDY?ni%o=BQZp&f~m_IHhlX_NY7;XqLoq zXxRBa0{%P{hnrwHNZK~A6hVGL0lC@PXu5_iCDOEzi40~e3h6iw4eCw7!HE4vpHY)< z?>~NW-GAc;{1*VEtc6a0?)J5x)p%{QXY?F?72ybyQSw)4ov)v$U_SNr4I$R7JHX4~sBhx8t+XN}Fq>T^) zp$gCxq{D-*sAQrMqMZ@k&J^40I|+vQ)fvBiVEO+E0Dxp{pWp2p5dG-SkA66{pm1)u zvx$bN|RDskunMR9@Y@OJXUTgOxiOI&?5QBIeeK^RFEH z{~Umo*o*2JNFufmk8c3GrOeuLLQbj6KrVUsN<&-*A#V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{w@2JU!5}N ziH&c)aZW*^0~c`u4MA2s_BzAM=d*VEPE^Z4suCeo6zgzL;5Jp1n1vRMK}!fL+J$ar z=vUU8XrUK1&w+DfIm4#TWZ<}oMA9lP9VXv@w*%ejAfRW{dt@P3o-m2KZ@h-fw(R2E za3_wXyXk6;;WRAb0?Mb4Ao<3JbXp0FxQXKNA*?jg6qqg@XIVc=`un-*%GnkD+-l>H zz5@N?wU(5bjcC>l{ANGb~P_9o6b z=|+BY`=8O>WtdVTl?=9`U?>(^ILXE*Ut`0wui$9tgitrCna0Rbp*ROM%YmH>h6=u{ zeDVrQmQOA+@)K?^bPN;K-xdlHAQH^JikDO)S;MZD!cC zvyF+zEk+87f&?khbe)Qdifu<9ee}aimMnP(VA--|$1hyC@bgS2gJm5qg^J%)v1~{P zNmy0rvLI^P*c={DMeQ`r4M7&2cQN>{!SV-?#cpz3UX1!6dMH9F9s_as zXtX4UcYV@Ekx>-OKoCM^EV6xqyuRg>4m^pWmn=pZG!}=q2zRTF8k3k-2Fprg7-^J} zEPA$glkj91?;pUL6`OG2MA`yVbyK;&{cu3r65BpJkPY}eD}jCOn1h3@$RK8 z2zZdWP87w1rAn-WEhsqw(p?dREfDtMR`c+`I54$1nwf*57_9i{0Kxhok#raN1#W&d ze=Y-OjK}PZvaj|Kg=T_)(}9!{;m|PSX$r@VXV-gQQ15>&3f7WqivQrp_ z_4nKsKWW^glt?M5tE)pwx!}0tj$0sv_}S&|{{to7QC#1!x(EOO002ovPDHLkV1fk7 B9d!Tz literal 0 HcmV?d00001 diff --git a/logger.go b/logger.go new file mode 100644 index 00000000..675f7d06 --- /dev/null +++ b/logger.go @@ -0,0 +1,20 @@ +package main + +// loggerConfig := zap.NewDevelopmentConfig() +// loggerConfig.OutputPaths = append(loggerConfig.OutputPaths, "logs/server.log") + +// logger, _ := loggerConfig.Build() + +// logTime := func(ctx *aero.Context, next func()) { +// start := time.Now() +// next() +// responseTime := time.Since(start) + +// if ctx.StatusCode == 200 { +// logger.Info(ctx.URI(), zap.Duration("responseTime", responseTime), zap.Int("statusCode", ctx.StatusCode)) +// } else { +// logger.Warn(ctx.URI(), zap.Duration("responseTime", responseTime), zap.Int("statusCode", ctx.StatusCode)) +// } +// } + +// app.Use(logTime) diff --git a/main.go b/main.go index d0e42778..b886bb7d 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "io/ioutil" "github.com/aerogo/aero" @@ -52,10 +51,15 @@ func main() { return ctx.JSON(app.Config.Manifest) }) - app.Get("/ip", func(ctx *aero.Context) string { - ip := ctx.RealIP() - fmt.Println(ip) - return ctx.Text(ip) + app.Get("/favicon.ico", func(ctx *aero.Context) string { + ctx.SetHeader("Content-Type", "image/x-icon") + data, _ := ioutil.ReadFile("images/icons/favicon.ico") + return string(data) + }) + + // For benchmarks + app.Get("/hello", func(ctx *aero.Context) string { + return ctx.Text("Hello World") }) // Scripts @@ -67,11 +71,6 @@ func main() { return js }) - // For testing - app.Get("/hello", func(ctx *aero.Context) string { - return ctx.Text("Hello World") - }) - // Let's go app.Run() }