Initial project structure using Flamego
This commit is contained in:
		
							
								
								
									
										146
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										146
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,132 +1,26 @@
 | 
				
			|||||||
# ---> Node
 | 
					# ---> Go
 | 
				
			||||||
# Logs
 | 
					# If you prefer the allow list template instead of the deny list, see community template:
 | 
				
			||||||
logs
 | 
					# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
 | 
				
			||||||
*.log
 | 
					#
 | 
				
			||||||
npm-debug.log*
 | 
					# Binaries for programs and plugins
 | 
				
			||||||
yarn-debug.log*
 | 
					*.exe
 | 
				
			||||||
yarn-error.log*
 | 
					*.exe~
 | 
				
			||||||
lerna-debug.log*
 | 
					*.dll
 | 
				
			||||||
.pnpm-debug.log*
 | 
					*.so
 | 
				
			||||||
 | 
					*.dylib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Diagnostic reports (https://nodejs.org/api/report.html)
 | 
					# Test binary, built with `go test -c`
 | 
				
			||||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
 | 
					*.test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Runtime data
 | 
					# Output of the go coverage tool, specifically when used with LiteIDE
 | 
				
			||||||
pids
 | 
					*.out
 | 
				
			||||||
*.pid
 | 
					 | 
				
			||||||
*.seed
 | 
					 | 
				
			||||||
*.pid.lock
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Directory for instrumented libs generated by jscoverage/JSCover
 | 
					# Dependency directories (remove the comment below to include it)
 | 
				
			||||||
lib-cov
 | 
					vendor/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Coverage directory used by tools like istanbul
 | 
					# Go workspace file
 | 
				
			||||||
coverage
 | 
					go.work
 | 
				
			||||||
*.lcov
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# nyc test coverage
 | 
					# Compiled binary
 | 
				
			||||||
.nyc_output
 | 
					blt
 | 
				
			||||||
 | 
					 | 
				
			||||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
 | 
					 | 
				
			||||||
.grunt
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Bower dependency directory (https://bower.io/)
 | 
					 | 
				
			||||||
bower_components
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# node-waf configuration
 | 
					 | 
				
			||||||
.lock-wscript
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
 | 
					 | 
				
			||||||
build/Release
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Dependency directories
 | 
					 | 
				
			||||||
node_modules/
 | 
					 | 
				
			||||||
jspm_packages/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Snowpack dependency directory (https://snowpack.dev/)
 | 
					 | 
				
			||||||
web_modules/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# TypeScript cache
 | 
					 | 
				
			||||||
*.tsbuildinfo
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Optional npm cache directory
 | 
					 | 
				
			||||||
.npm
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Optional eslint cache
 | 
					 | 
				
			||||||
.eslintcache
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Optional stylelint cache
 | 
					 | 
				
			||||||
.stylelintcache
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Microbundle cache
 | 
					 | 
				
			||||||
.rpt2_cache/
 | 
					 | 
				
			||||||
.rts2_cache_cjs/
 | 
					 | 
				
			||||||
.rts2_cache_es/
 | 
					 | 
				
			||||||
.rts2_cache_umd/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Optional REPL history
 | 
					 | 
				
			||||||
.node_repl_history
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Output of 'npm pack'
 | 
					 | 
				
			||||||
*.tgz
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Yarn Integrity file
 | 
					 | 
				
			||||||
.yarn-integrity
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# dotenv environment variable files
 | 
					 | 
				
			||||||
.env
 | 
					 | 
				
			||||||
.env.development.local
 | 
					 | 
				
			||||||
.env.test.local
 | 
					 | 
				
			||||||
.env.production.local
 | 
					 | 
				
			||||||
.env.local
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# parcel-bundler cache (https://parceljs.org/)
 | 
					 | 
				
			||||||
.cache
 | 
					 | 
				
			||||||
.parcel-cache
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Next.js build output
 | 
					 | 
				
			||||||
.next
 | 
					 | 
				
			||||||
out
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Nuxt.js build / generate output
 | 
					 | 
				
			||||||
.nuxt
 | 
					 | 
				
			||||||
dist
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Gatsby files
 | 
					 | 
				
			||||||
.cache/
 | 
					 | 
				
			||||||
# Comment in the public line in if your project uses Gatsby and not Next.js
 | 
					 | 
				
			||||||
# https://nextjs.org/blog/next-9-1#public-directory-support
 | 
					 | 
				
			||||||
# public
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# vuepress build output
 | 
					 | 
				
			||||||
.vuepress/dist
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# vuepress v2.x temp and cache directory
 | 
					 | 
				
			||||||
.temp
 | 
					 | 
				
			||||||
.cache
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Docusaurus cache and generated files
 | 
					 | 
				
			||||||
.docusaurus
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Serverless directories
 | 
					 | 
				
			||||||
.serverless/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# FuseBox cache
 | 
					 | 
				
			||||||
.fusebox/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# DynamoDB Local files
 | 
					 | 
				
			||||||
.dynamodb/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# TernJS port file
 | 
					 | 
				
			||||||
.tern-port
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Stores VSCode versions used for testing VSCode extensions
 | 
					 | 
				
			||||||
.vscode-test
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# yarn v2
 | 
					 | 
				
			||||||
.yarn/cache
 | 
					 | 
				
			||||||
.yarn/unplugged
 | 
					 | 
				
			||||||
.yarn/build-state.yml
 | 
					 | 
				
			||||||
.yarn/install-state.gz
 | 
					 | 
				
			||||||
.pnp.*
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
Copyright (c) <year> <owner> 
 | 
					Copyright (c) 2023 Bit Goblin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
 | 
					Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										24
									
								
								blt.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								blt.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					package main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"github.com/flamego/flamego"
 | 
				
			||||||
 | 
						"github.com/flamego/template"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						web "git.metaunix.net/bitgoblin/blt/src/web"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func main() {
 | 
				
			||||||
 | 
						// initialize Flamego instance
 | 
				
			||||||
 | 
						f := flamego.Classic()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// enable templates
 | 
				
			||||||
 | 
					  f.Use(template.Templater(template.Options{
 | 
				
			||||||
 | 
					  	Directory: "./views",
 | 
				
			||||||
 | 
					  }))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // register routes
 | 
				
			||||||
 | 
					  web.RegisterRoutes(f)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // start Flamego
 | 
				
			||||||
 | 
					  f.Run()
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										21
									
								
								go.mod
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								go.mod
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					module git.metaunix.net/bitgoblin/blt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					go 1.18
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require (
 | 
				
			||||||
 | 
						github.com/alecthomas/participle/v2 v2.0.0 // indirect
 | 
				
			||||||
 | 
						github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
 | 
				
			||||||
 | 
						github.com/charmbracelet/lipgloss v0.7.1 // indirect
 | 
				
			||||||
 | 
						github.com/charmbracelet/log v0.2.3 // indirect
 | 
				
			||||||
 | 
						github.com/flamego/flamego v1.9.4 // indirect
 | 
				
			||||||
 | 
						github.com/flamego/template v1.2.2 // indirect
 | 
				
			||||||
 | 
						github.com/go-logfmt/logfmt v0.6.0 // indirect
 | 
				
			||||||
 | 
						github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
 | 
				
			||||||
 | 
						github.com/mattn/go-isatty v0.0.18 // indirect
 | 
				
			||||||
 | 
						github.com/mattn/go-runewidth v0.0.14 // indirect
 | 
				
			||||||
 | 
						github.com/muesli/reflow v0.3.0 // indirect
 | 
				
			||||||
 | 
						github.com/muesli/termenv v0.15.2 // indirect
 | 
				
			||||||
 | 
						github.com/pkg/errors v0.9.1 // indirect
 | 
				
			||||||
 | 
						github.com/rivo/uniseg v0.2.0 // indirect
 | 
				
			||||||
 | 
						golang.org/x/sys v0.7.0 // indirect
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
							
								
								
									
										33
									
								
								go.sum
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								go.sum
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
				
			|||||||
 | 
					github.com/alecthomas/participle/v2 v2.0.0 h1:Fgrq+MbuSsJwIkw3fEj9h75vDP0Er5JzepJ0/HNHv0g=
 | 
				
			||||||
 | 
					github.com/alecthomas/participle/v2 v2.0.0/go.mod h1:rAKZdJldHu8084ojcWevWAL8KmEU+AT+Olodb+WoN2Y=
 | 
				
			||||||
 | 
					github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
 | 
				
			||||||
 | 
					github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
 | 
				
			||||||
 | 
					github.com/charmbracelet/lipgloss v0.7.1 h1:17WMwi7N1b1rVWOjMT+rCh7sQkvDU75B2hbZpc5Kc1E=
 | 
				
			||||||
 | 
					github.com/charmbracelet/lipgloss v0.7.1/go.mod h1:yG0k3giv8Qj8edTCbbg6AlQ5e8KNWpFujkNawKNhE2c=
 | 
				
			||||||
 | 
					github.com/charmbracelet/log v0.2.3 h1:YVmBhJtpGL7nW/nlf5u+SEloU8XYljxozGzZpgwIvhs=
 | 
				
			||||||
 | 
					github.com/charmbracelet/log v0.2.3/go.mod h1:ZApwwzDbbETVTIRTk7724yQRJAXIktt98yGVMMaa3y8=
 | 
				
			||||||
 | 
					github.com/flamego/flamego v1.9.4 h1:SNsooIfNa6ljQM1rBmfg4cFcXPIhQdG/uvNHqXxPvD8=
 | 
				
			||||||
 | 
					github.com/flamego/flamego v1.9.4/go.mod h1:2tAVbugA3fgX8xOBoqR2jmJSSvZDLBFGXTFCR5h5eAU=
 | 
				
			||||||
 | 
					github.com/flamego/template v1.2.2 h1:aMpt8RzXBb2ZGuABf9p/q8oBBpXrurUV8rgBbz7mj2o=
 | 
				
			||||||
 | 
					github.com/flamego/template v1.2.2/go.mod h1:xTAmwCCPaOuxN5t4CpzOP7WZN5WkLRiJfJCpsiB0aUg=
 | 
				
			||||||
 | 
					github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
 | 
				
			||||||
 | 
					github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
 | 
				
			||||||
 | 
					github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
 | 
				
			||||||
 | 
					github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
 | 
				
			||||||
 | 
					github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
 | 
				
			||||||
 | 
					github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
 | 
				
			||||||
 | 
					github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
 | 
				
			||||||
 | 
					github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
 | 
				
			||||||
 | 
					github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
 | 
				
			||||||
 | 
					github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
 | 
				
			||||||
 | 
					github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
 | 
				
			||||||
 | 
					github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo=
 | 
				
			||||||
 | 
					github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8=
 | 
				
			||||||
 | 
					github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
 | 
				
			||||||
 | 
					github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 | 
				
			||||||
 | 
					github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
 | 
				
			||||||
 | 
					github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
 | 
				
			||||||
 | 
					github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 | 
				
			||||||
							
								
								
									
										12
									
								
								src/web/routes.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/web/routes.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					package web
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"github.com/flamego/flamego"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"git.metaunix.net/bitgoblin/blt/src/web/routes"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func RegisterRoutes(f *flamego.Flame) {
 | 
				
			||||||
 | 
						// top-level routes
 | 
				
			||||||
 | 
						f.Get("/", routes.GetTopIndex)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										12
									
								
								src/web/routes/top.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/web/routes/top.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					package routes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"net/http"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/flamego/template"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func GetTopIndex(t template.Template, data template.Data) {
 | 
				
			||||||
 | 
						data["title"] = "Dashboard"
 | 
				
			||||||
 | 
						t.HTML(http.StatusOK, "index")
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										11
									
								
								views/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								views/index.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					<!DOCTYPE html>
 | 
				
			||||||
 | 
					<html lang="en">
 | 
				
			||||||
 | 
					<head>
 | 
				
			||||||
 | 
					  <meta charset="UTF-8">
 | 
				
			||||||
 | 
					  <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
				
			||||||
 | 
					  <title>{{ .title }}</title>
 | 
				
			||||||
 | 
					</head>
 | 
				
			||||||
 | 
					<body>
 | 
				
			||||||
 | 
					  <p>This is a test!</p>
 | 
				
			||||||
 | 
					</body>
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user