React Gin Blog (9/19): Hashing password

In last section we have created users table in our database, but we are currently storing user’s password in plain text. This is something we should never do, and instead we need to store hashed password with random salt. For that we will use golang/crypto library. First we need to expand our User structure: ThereContinue reading “React Gin Blog (9/19): Hashing password”

React Gin Blog (8/19): Migrations

With database created, we also need to create tables in which our data will be store. And best way to do that is using migrations. We will be using go-pg/migrations module. On GitHub page you can find basic installation and usage guide, and we will use that. Let’s start by creating new directory migrations/ insideContinue reading “React Gin Blog (8/19): Migrations”

React Gin Blog (7/19): Connecting with database

So far our backend is working very well. We can create user and login, but as soon we restart our server, that user data is lost, since it is saved only in memory while app is running. Of course that’s not realistic case and we want to save all user data even if server isContinue reading “React Gin Blog (7/19): Connecting with database”

React Gin Blog (6/19): Form validations

As we saw in previous section, our handlers are working as expected when we pass valid data. But what about not valid data? Or missing data? Let’s test this. First, let’s remove (or just comment) Password: passwordValue from our submitHandler() inside of assets/src/components/Auth/AuthForm.js. This way, our backend will send only Username, without Password. Let’s nowContinue reading “React Gin Blog (6/19): Form validations”

React Gin Blog (5/19): Adding user

We are making simple blog, so first thing we have to do is to implement some way for users to create account and log in. For now, we will just make simple struct User that will be stored in memory. Latter we will connect our application with a database so we can store our dataContinue reading “React Gin Blog (5/19): Adding user”

React Gin Blog (4/19): Structure project directories

It’s always good practice to separate your code based on what every part is doing, so it’s easier to find relevant part later on, so we will do just that before going further. In root project directory we will create new directories cmd/rgb/ and we will move our main.go file there. That will be entryContinue reading “React Gin Blog (4/19): Structure project directories”

React Gin Blog (3/19): Add React frontend

With first API route set, let’s add React frontend before continuing further. Covering React is out of this tutorial’s scope, but there are a lot of React development guides over the Internet that you can check. Even though i will not go into details about React implementation, i will show you how to setup ReactContinue reading “React Gin Blog (3/19): Add React frontend”

React Gin Blog (2/19): Starting Gin server

First we need to give our Web App a name. We will be making a simple blog, so let’s call it RGB (React Gin Blog). We will start by making project root directory inside of ~/go/src/ and making it our current working directory. Our first dependency is Gin framework. You can download it by running go get github.com/gin-gonic/gin if you don’t have it already. Before writing our first backend source file, we need to crate go.mod file in project root directory needed by Golang to find and import required dependencies. Content of thatContinue reading “React Gin Blog (2/19): Starting Gin server”

React Gin Blog (1/19): Golang and React Web App guide

This guide will show you how to build full stack Web App from scratch using Go programming language, Gin and React frameworks. Go (or sometimes called GoLang) is an open source programming language developed by Google. More info, as well as download link can be found on official web page. Gin is lightweight but high-performanceContinue reading “React Gin Blog (1/19): Golang and React Web App guide”