---
title: "Discussion on \"Introduction to Golang: build a mini Twitter clone\" | Hashnode"
description: "Discussion on \"Introduction to Golang: build a mini Twitter clone\". Learn how to build a mini twitter clone backend. Make a simple API using Golang that interacts with a SQL database and learn the basics of Go syntax."
url: "https://hashnode.com/posts/introduction-to-golang-build-a-mini-twitter-clone/62bd0596a5678c068452dbaf"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Introduction to Golang: build a mini Twitter clone](https://bognov.tech/introduction-to-golang-build-a-mini-twitter-clone?utm_source=hashnode&utm_medium=feed)

Learn how to build a mini twitter clone backend. Make a simple API using Golang that interacts with a SQL database and learn the basics of Go syntax.

Jun 30, 2022 · 15 min read · bognov.tech  
Read the article

-   [#go](https://hashnode.com/tag/go)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#beginners](https://hashnode.com/tag/beginners)
-   [#backend](https://hashnode.com/tag/backend)
-   [#apis](https://hashnode.com/tag/apis)

## Written by

[Bogdan N.](https://hashnode.com/@bog)

@bog · Spain

  
[View profile](https://hashnode.com/@bog)

software engineer

Full Stack Software Engineer, trying to improve one line of code at a time.

## Responses 4

Markdown supported · ⌘↵ to post

[Elvis Van](https://hashnode.com/@elvisvan)

[Jun 30, 2022](https://hashnode.com/posts/introduction-to-golang-build-a-mini-twitter-clone/62bd0596a5678c068452dbaf/comment/62bde18b79c4ef14aeaad77a)

this is one hell of a long post lol, saved for later, thanks👍🏻

[Bogdan N.](https://hashnode.com/@bog)

[Jun 30, 2022](https://hashnode.com/posts/introduction-to-golang-build-a-mini-twitter-clone/62bd0596a5678c068452dbaf/comment/62bde18b79c4ef14aeaad77a#reply-62be27b763efe017ba654fc4)

Aahaha, yeah I know. I hope it's useful!

[Eleftheria Batsou](https://hashnode.com/@eleftheriabatsou)

[Jun 30, 2022](https://hashnode.com/posts/introduction-to-golang-build-a-mini-twitter-clone/62bd0596a5678c068452dbaf/comment/62bd4997a5678c068452e67b)

Nice work [Bogdan N.](https://hashnode.com/@bog) :)

[Bogdan N.](https://hashnode.com/@bog)

[Jun 30, 2022](https://hashnode.com/posts/introduction-to-golang-build-a-mini-twitter-clone/62bd0596a5678c068452dbaf/comment/62bd4997a5678c068452e67b#reply-62bdcfbbe4246414d3d2d8eb)

Thanks [Eleftheria Batsou](https://hashnode.com/@eleftheriabatsou)!😁

[Nicolás Parada](https://hashnode.com/@nicolasparada)

[Jun 30, 2022](https://hashnode.com/posts/introduction-to-golang-build-a-mini-twitter-clone/62bd0596a5678c068452dbaf/comment/62bd16e9de0d0a065f4f6f1c)

```
dbQuery := "SELECT users.user_id, users.user, users.first_name, users.last_name, tweets.tweet, tweets.date_tweet FROM users INNER JOIN tweets ON users.user_id = tweets.user_id INNER JOIN followers ON users.user_id = followers.id_user WHERE followers.id_follower = ? ORDER BY tweets.date_tweet DESC;"
rows, err := database.DB.Query(dbQuery, c.Params("id"))
```

You can avoid SQL injection by this simple change. Use a placeholder (`?`) for the argument in the query and pass the argument in the `db.Query` method.

[Bogdan N.](https://hashnode.com/@bog)

[Jun 30, 2022](https://hashnode.com/posts/introduction-to-golang-build-a-mini-twitter-clone/62bd0596a5678c068452dbaf/comment/62bd16e9de0d0a065f4f6f1c#reply-62bdac8e79c4ef14aeaacf05)

Definitely!

Yeah I wanted to approach the project as someone who didn't know much about SQL and show the errors as well. However I might edit it a bit just in case people end up copying it anyway.

Thanks!
