DEV Community

George Calianu
George Calianu

Posted on • Updated on

Server side application skeleton for Go language

Writing web application in Go can be pretty hard if you take care about login process wich include signing in, singing out, password recovery and minimal user management (like changing name, password and deleting account).

The solution can be a high level skeleton to help all those developers to focus on the application content.

Project is a work in progress, hosted on Github and is documented with code examples and some pictures.

https://github.com/geosoft1/ssas

How the things works? Supposing you have some experience with Go language and Mysql database, download the project from repository and compile.

You must create a database on your server and import database.sql file into (adjust before the file with your database name). In model folder you will find a model for Mysql Workbench application. You can use this model to sincronize with an existing database.

Next, you must complete the configuration file conf.json. Basically you must set the database connection informations like ip/domain, user, password and schema name.

Also, you may need to set the mailer for password recovery procedure. No big deal here, use a mailbox created for this purpose.

If you run the skeleton for the first time you will be asked to add a new user (or signup).

signup

Feel free to do this and then login

signin

After that you must see the home page

home

You can manage local user account, logout and recovery forgotten password by clicking on the options from the top right bar.

user

A nice part is that you have a fallback offline page for network fails.

home

Now you are ready to write your applications, take a look over how to add simple application section from documentation to see how to extend the skeleton with new functionalities. A dummy example explain this.

Note that you will need a HTML5 browser to see the application but you shouldn't have problems with modern browsers. You can also use Chrome application mode for an experience more closest to native applications.

Enjoy.

Top comments (3)

Collapse
 
oduhart profile image
Olivier Duhart

Thanks for sahring your work. How hard would it be to extend it to use oauth providers like google, facebook, github and such ?

Collapse
 
geosoft1 profile image
George Calianu • Edited

Well, I guess it's a bit harder. Even if the original intention was not writing a performat login system but a start point for custom web applications I will consider any improvement suggestions to be made in my spare time.
If you want to make some tries, I saw some nice resources on the internet (untested)

sohamkamani.com/blog/golang/2018-0...

Collapse
 
nandakumarpcbe profile image
nandakumar.p.cbe

Currently I'm learning Golang.
Thanks for sharing your code.
I think this code will very useful for me to develop my own web application.

Thank you a lot.