Golang,tailwind and vue Olx clone

Let’s start!!!

I assume that you have Golang and Postgres installed and that you are not a complete beginner.

Most of the time, when I start with the Gofiber project, I am starting with this repo from gofiber recipes Starter template. It saves a lot of time, and it comes with a nice MVC organization of folders.
After we download this repository, we will change from gorm v1 to v2.

You will do it like this:
1. Type in console go get -u gorm.io/driver/postgres
2. Type in console go get -u gorm.io/gorm
3. Make a copy of the .env.sample and rename it to .env and change it with your Postgres access.

The next step will be to change every file you find “github.com/jinzhu/gorm” to “gorm.io/gorm” and replace the content of the database/connect.go with this one:
`package database

import (


// ConnectDB connect to db
func ConnectDB() {
var err error
p := config.Config(“DB_PORT”)
port, err := strconv.ParseUint(p, 10, 32)

dsn := fmt.Sprintf(“host=%s port=%d user=%s password=%s dbname=%s sslmode=disable”, config.Config(“DB_HOST”), port, config.Config(“DB_USER”), config.Config(“DB_PASSWORD”), config.Config(“DB_NAME”))

DB, err = gorm.Open(postgres.Open(dsn), &gorm.Config{})

if err != nil {
panic(“failed to connect database”)

fmt.Println(“Connection Opened to Database”)
DB.AutoMigrate(&model.Product{}, &model.User{})
fmt.Println(“Database Migrated”)

The next step will be to go in handler/auth and import the “errors” package and change line 26 and 38 from
`if gorm.IsRecordNotFoundError(err) {

to gorm v2 syntax
if errors.Is(err, gorm.ErrRecordNotFound) {


After all this, we finally can start our project with
`go run ./main.go`
I usually use Postman to test it, thanks to repo documentation. We have our collection ready to use for Postman.
Just visit this link [Postman collection](https://www.postman.com/collections/c862d012d5dcf50326f7) and import collection, and you can start testing.

Next time we will make our database with gorm make all models we need. Maybe we will add some models later, but this is all for today.




Full stack developer with interest in golang, laravel, php, and vuejsn

Love podcasts or audiobooks? Learn on the go with our new app.

Wrestling with Customer Engagement

Blog Post 6

Lazy Loading Images in UICollectionView using NSOperation and NSOperationQueue in Swift

Workout #2: Summing Numbers

Ingest and Stream Huawei ECS Log Data in Real-time using Amazon Kinesis agent and Kinesis Firehose

Is your App online? Conceptual with RxKotlin/Java Pt.2

Invertible Bloom Lookup Table

Passing custom arguments to a ViewModel + LiveData

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
bajro lisić

bajro lisić

Full stack developer with interest in golang, laravel, php, and vuejsn

More from Medium

Serving CSS In Go’s Native Server

Reverse Proxy Nginx on Ubuntu 20 — Adonis JS Deployment using PM2

Deployment of a Dart Server on Heroku

How to build AdonisJS API to store your Raspberry Pi Temperature