Automating web browser is pretty common and it’s nothing new. Selenium is de facto industry standard and there are libraries for various programming languages with most common being Java and Ruby. What’s less common is writing Selenium automated tests using Golang, so this blog post will be exactly about that. Most of the code isContinue reading “Selenium WebDriver test automation using Golang”
Golang is really not the best choice when it comes to developing desktop apps, but it is still possible. One example of viable use case for Golang desktop app would be to quickly add graphical interface for existing CLI app. And Fyne is great framework for that purpose. As stated on their official GitHub page,Continue reading “Fyne (Golang) desktop app with goroutines”
Some time ago i stumbled upon an issue that was giving me a headache. I had to download and import private Go module, and as it turns out, that can be little tricky. I’m using SSH keys for authenticating with my repositories, so this solution is applied only for that type of authentication.Of course, iContinue reading “Go modules and private GIT repositories”
Our server is finished and almost ready for deploy, which will be done using Docker. Notice that i said it’s almost ready, so let’s see what is missing. This whole time we used React development server which is listening on port 3000 and redirecting all requests to our backend on port 8080. That makes senseContinue reading “React Gin Blog (19/19): Docker deploy”
Writing unit and integration tests is important part of software development and it’s something ideally done during development, but in this guide i dedicated one chapter for that since there are some prerequisites required before we can start to write tests. For instance, main thing to do is to create test database. This will beContinue reading “React Gin Blog (18/19): Tests”
If our server process gets signal to shut it down, we would like to finish the request currently handling before that happens. For that we will use graceful shutdown provided by Gin. This example is explained in detail on Gin GitHub with description in comments, so i will not go into details myself. Our internal/server/server.goContinue reading “React Gin Blog (17/19): Graceful shutdown”
Custom validation errors are added in previous chapter, but what about database errors? If you try to create account with already existing username, you will get error ERROR #23505 duplicate key value violates unique constraint “users_username_key”. Unfortunately, there is no validator involved here and pg module returns most of the errors as map[byte]string so thisContinue reading “React Gin Blog (16/19): Custom database errors”
If you try to create new account using too short password, you will get error Key: ‘User.Password’ Error:Field validation for ‘Password’ failed on the ‘min’ tag. This is not really user friendly, so it should be changed for better user experience. Let’s see how we can transform that to our own custom error messages. ForContinue reading “React Gin Blog (15/19): Custom validation errors”
With authentication in place, it is time to start using it. We will need authentication to create, read, update and delete user’s blog posts. Let’s start by adding new database migration which will create required data table with columns. Create new migration file migrations/2_addPostsTable.go: And then run migrations with: Now we create structure to holdContinue reading “React Gin Blog (14/19): Add user posts”
Authentication is one of the most important part of almost every web application. We must ensure that every user can create, read, update and delete only data for which it’s authorized. For that purpose we will use JWT (JSON Web Token). Fortunately, there are various Golang modules specialized for this. One that will be usedContinue reading “React Gin Blog (13/19): JWT authentication”
Something went wrong. Please refresh the page and/or try again.
Follow My Blog
Get new content delivered directly to your inbox.