An example Golang Web Application
When I first started developing websites in the Go programming language, I frequently wished that there was a complete example of a simple but complete web application that I could inspect.
heyfyi aims to fill the need that I had as a developer. This project is designed to be a complete example for the novice developer, featuring basics such as a secure accounts system, email transmission, in-depth templating, and a basic AJAX api for some web requests.
The program was designed around the gocraft mux and middleware package.
It is built to the following architecture diagram:
Absolutely. It is possible that there are mistakes, conceptual or otherwise, in the code. If you spot any, please submit an issue or a pull request!
In addition, as I do not have much experience with UI, there are many places where this could be improved.
You can go get github.com/kiwih/heyfyi
this project.
Once you have acquired it, go get -u
then go build
.
As this program uses sqlite, you will need gcc to use cgo. If you are developing on windows, I recommend mingw-64 and not cygwin.
Finally, you can run it by running ./heyfyi
On the first run, it will create the database file and tables.
This will contain a default fact and a default admin user.
You can sign in to the default admin user with username/password both test@test
.
$COOKIE_STORE_SALT
- used in cookie encryption. It defaults to SUPER_SECRET_SALT
for testing purposes only.
$HTTP_PORT
- set the HTTP port to listen on. Defaults to 3000
.
$LOG_FILE_NAME
- set the logfile name for logging. Defaults to heyfyi.txt
.