<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: oritsegbubemi</title>
    <description>The latest articles on DEV Community by oritsegbubemi (@gbubemi22).</description>
    <link>https://dev.to/gbubemi22</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F716552%2F7869693d-a9c2-4569-b0e6-356845d9e1e6.jpg</url>
      <title>DEV Community: oritsegbubemi</title>
      <link>https://dev.to/gbubemi22</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gbubemi22"/>
    <language>en</language>
    <item>
      <title>Building a Simple Chat Application with Go, Gin, MongoDB, and WebSocket</title>
      <dc:creator>oritsegbubemi</dc:creator>
      <pubDate>Sat, 27 Jul 2024 18:39:11 +0000</pubDate>
      <link>https://dev.to/gbubemi22/building-a-simple-chat-application-with-go-gin-mongodb-and-websocket-2joo</link>
      <guid>https://dev.to/gbubemi22/building-a-simple-chat-application-with-go-gin-mongodb-and-websocket-2joo</guid>
      <description>&lt;p&gt;In this tutorial, we will walk through building a simple chat application using Go, Gin, MongoDB, and WebSocket. We'll set up a backend server to handle HTTP requests and WebSocket connections, and manage chat messages and user interactions.&lt;/p&gt;

&lt;p&gt;Prerequisites&lt;br&gt;
  . Go installed on your machine.&lt;br&gt;
  . MongoDB running locally or on a remote server.&lt;br&gt;
  . Basic understanding of Go, Gin, and MongoDB.&lt;/p&gt;

&lt;p&gt;Project Structure&lt;br&gt;
We'll organize our project into several packages:&lt;/p&gt;

&lt;p&gt;. main: Entry point of the application.&lt;br&gt;
 . server: Initializes the server and routes.&lt;br&gt;
 . controller: Handles HTTP requests.&lt;br&gt;
 . middleware: Contains middleware functions.&lt;br&gt;
 . database: Manages MongoDB connections.&lt;br&gt;
 . service: Contains business logic.&lt;br&gt;
 . model: Defines data models.&lt;br&gt;
 . websocket: Manages WebSocket connections.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Setting Up the Main Package
Create a main.go file as the entry point of the application:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh3m90vox3cpj3kif24wl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh3m90vox3cpj3kif24wl.png" alt="Image description" width="800" height="833"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Creating the Server Package
In the server package, we'll initialize the server, set up routes, and handle WebSocket connections.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw2hf0mkpxvogtqf2n44b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw2hf0mkpxvogtqf2n44b.png" alt="Image description" width="800" height="1459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffouvorq7v2t9jbmhk3x2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffouvorq7v2t9jbmhk3x2.png" alt="Image description" width="800" height="1652"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Defining Models
Define the Message and Conversation models in the model package.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9vjy6v7mcqs88g2p61b1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9vjy6v7mcqs88g2p61b1.png" alt="Image description" width="800" height="639"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9cz47ehpm2qmvqzgrq09.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9cz47ehpm2qmvqzgrq09.png" alt="Image description" width="800" height="659"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Connecting Database&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffen9zm2jeo8nlk46q95g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffen9zm2jeo8nlk46q95g.png" alt="Image description" width="800" height="1562"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Implementing WebSocket Functionality
Create the websocket package to manage WebSocket connections and messages.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;WebSocketServer Structure&lt;br&gt;
This structure holds information about the WebSocket server, including connected clients, channels for broadcasting messages, and services for conversations and messages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmymhtnjr6dul21eraypb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmymhtnjr6dul21eraypb.png" alt="Image description" width="800" height="1044"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Upgrader&lt;br&gt;
The upgrader is used to upgrade HTTP connections to WebSocket connections. The CheckOrigin function allows connections from any origin.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcm6iatsru8ih9uqzepyg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcm6iatsru8ih9uqzepyg.png" alt="Image description" width="758" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;NewWebSocketServer&lt;br&gt;
This function creates a new instance of WebSocketServer, initializing its properties and returning it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Febexh390oi8da78vg4iq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Febexh390oi8da78vg4iq.png" alt="Image description" width="800" height="289"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run Method&lt;br&gt;
This method starts the WebSocket server by listening on port 8081 and handling connections at the /ws/chat endpoint. It also starts a goroutine to handle messages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F69hpp267x91tyc89tu7y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F69hpp267x91tyc89tu7y.png" alt="Image description" width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;HandleConnections Method&lt;br&gt;
This method upgrades an HTTP connection to a WebSocket connection, registers the new connection, and listens for incoming messages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnz33btr4sdejofqw9385.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnz33btr4sdejofqw9385.png" alt="Image description" width="800" height="837"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;handleMessages Method&lt;br&gt;
This method listens for register, unregister, and broadcast events. It adds or removes clients from the list and sends broadcast messages to all connected clients.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkf3r8l7o857r8qjvpb4y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkf3r8l7o857r8qjvpb4y.png" alt="Image description" width="800" height="837"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Handling Actions&lt;br&gt;
The server handles different types of actions received from clients, such as creating a conversation, fetching a conversation, and sending a message.&lt;/p&gt;

&lt;p&gt;Create Conversation&lt;br&gt;
This action creates a new conversation with the given sender and receiver IDs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6kydjjsdtaebq8jrqryd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6kydjjsdtaebq8jrqryd.png" alt="Image description" width="800" height="1465"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Get Conversation by ID&lt;br&gt;
This action fetches a conversation by its ID and sends it back to the client.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fercx2nk9hfneyz4jnxrf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fercx2nk9hfneyz4jnxrf.png" alt="Image description" width="800" height="696"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Send Message&lt;br&gt;
This action creates a new message in a conversation and sends the created message back to the client.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbq4e1jx8yd4qdd1ylxcl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbq4e1jx8yd4qdd1ylxcl.png" alt="Image description" width="800" height="1165"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
In this tutorial, we have built a simple chat application using Go, Gin, MongoDB, and WebSocket. We've covered setting up the server, defining models, and handling WebSocket connections. You can extend this application by adding more features like authentication, file uploads, and real-time notifications.&lt;/p&gt;

&lt;p&gt;full code can be found&lt;br&gt;
&lt;a href="https://github.com/gbubemi22/goSetup.git" rel="noopener noreferrer"&gt;https://github.com/gbubemi22/goSetup.git&lt;/a&gt;&lt;/p&gt;

</description>
      <category>go</category>
      <category>websocket</category>
      <category>mongodb</category>
    </item>
    <item>
      <title>How to Upload Images to AWS S3 with Golang</title>
      <dc:creator>oritsegbubemi</dc:creator>
      <pubDate>Thu, 04 Jul 2024 12:44:20 +0000</pubDate>
      <link>https://dev.to/gbubemi22/how-to-upload-images-to-aws-s3-with-golang-1e3c</link>
      <guid>https://dev.to/gbubemi22/how-to-upload-images-to-aws-s3-with-golang-1e3c</guid>
      <description>&lt;p&gt;In this tutorial, we will walk through the steps to upload images to AWS S3 using Golang. We'll cover setting up the necessary packages, configuring AWS, and writing the code to handle the image upload. Let's get started!&lt;/p&gt;

&lt;p&gt;Prerequisites&lt;br&gt;
Before we begin, ensure you have the following:&lt;/p&gt;

&lt;p&gt;. An AWS account with S3 access.&lt;br&gt;
. Go installed on your machine.&lt;br&gt;
. A basic understanding of Go and its ecosystem.&lt;/p&gt;

&lt;p&gt;mkdir go_mongoDb&lt;br&gt;
cd go_mongoDb&lt;br&gt;
go mod init go_mongoDb&lt;/p&gt;

&lt;p&gt;Next, install the required packages:&lt;/p&gt;

&lt;p&gt;go get github.com/aws/aws-sdk-go-v2&lt;br&gt;
go get github.com/aws/aws-sdk-go-v2/config&lt;br&gt;
go get github.com/aws/aws-sdk-go-v2/service/s3&lt;br&gt;
go get github.com/aws/aws-sdk-go-v2/feature/s3/manager&lt;br&gt;
go get github.com/gin-gonic/gin&lt;br&gt;
go get github.com/joho/godotenv&lt;br&gt;
go get go.mongodb.org/mongo-driver/mongo&lt;/p&gt;

&lt;p&gt;tep 2: Configuring AWS&lt;br&gt;
Create a .env file in the root of your project and add your AWS credentials:&lt;/p&gt;

&lt;p&gt;AWS_REGION=your-aws-region&lt;br&gt;
AWS_ACCESS_KEY_ID=your-access-key-id&lt;br&gt;
AWS_SECRET_ACCESS_KEY=your-secret-access-key&lt;/p&gt;

&lt;p&gt;Step 3: Writing the Upload Code&lt;br&gt;
Create a file named upload.go under a utils package and add the following code:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxtxamn1tv0es518rxx3s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxtxamn1tv0es518rxx3s.png" alt="Image description" width="800" height="1741"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 4: Integrating with Your Application&lt;/p&gt;

&lt;p&gt;Create a controller to handle image uploads. In your controller package, create a file named userController.go and Create service to handle the Bussiness logic, create a file named userService.go:&lt;/p&gt;

&lt;p&gt;Service&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F33wkyahmw9acuu4ee7uf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F33wkyahmw9acuu4ee7uf.png" alt="Image description" width="800" height="1128"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0zq08kirerrvxgndbi1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0zq08kirerrvxgndbi1.png" alt="Image description" width="800" height="969"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Controller&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuy2u8qyaahqozq8wskdg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuy2u8qyaahqozq8wskdg.png" alt="Image description" width="800" height="1633"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 5: Setting Up Routes&lt;br&gt;
In your server package, create a server.go file to set up the routes:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F894opmn7ljssyivq5sxh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F894opmn7ljssyivq5sxh.png" alt="Image description" width="800" height="941"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
You now have a working Go application that uploads images to AWS S3. This tutorial covered the essential steps to set up AWS configuration, write the upload logic, and integrate it with a web server using the Gin framework.&lt;/p&gt;

&lt;p&gt;Feel free to extend this example by adding user authentication, storing image URLs in a database, and more. Happy coding!&lt;/p&gt;

&lt;p&gt;get full code here&lt;br&gt;
&lt;a href="https://github.com/gbubemi22/goSetup.git" rel="noopener noreferrer"&gt;https://github.com/gbubemi22/goSetup.git&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>go</category>
      <category>gin</category>
    </item>
    <item>
      <title>How to send email with Go and MailTrap</title>
      <dc:creator>oritsegbubemi</dc:creator>
      <pubDate>Mon, 01 Jul 2024 18:15:09 +0000</pubDate>
      <link>https://dev.to/gbubemi22/how-to-send-email-with-go-and-mailtrap-3o6i</link>
      <guid>https://dev.to/gbubemi22/how-to-send-email-with-go-and-mailtrap-3o6i</guid>
      <description>&lt;p&gt;Sending emails is a common requirement in many applications. Whether it's for account verification, password reset, or notifications, integrating email functionality can enhance the user experience. In this post, we'll walk through the steps to send emails using Go, leveraging the &lt;code&gt;gomail&lt;/code&gt; package.&lt;/p&gt;

&lt;p&gt;Prerequisites&lt;br&gt;
Ensure you have the following dependencies in your go.mod file:&lt;/p&gt;

&lt;p&gt;require (&lt;br&gt;
    github.com/joho/godotenv v1.4.0&lt;br&gt;
    gopkg.in/gomail.v2 v2.0.0-20180604020328-0353e461b93c&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;Step 1: Create a .env file with the following content&lt;/p&gt;

&lt;p&gt;MAILTRAP_HOST=smtp.mailtrap.io&lt;br&gt;
MAILTRAP_PORT=2525&lt;br&gt;
MAILTRAP_USER=your_mailtrap_user&lt;br&gt;
MAILTRAP_PASS=your_mailtrap_password&lt;br&gt;
SENDER=&lt;a href="mailto:your_sender_email@example.com"&gt;your_sender_email@example.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 2: Create the SendMail Function&lt;br&gt;
Now, we will create the SendMail function to handle email sending. This function will read the configuration from the environment variables and use the gomail package to send the email.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxaze056rqos42ljdex5r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxaze056rqos42ljdex5r.png" alt="Image description" width="800" height="1806"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 3: Integrate Email Sending in Your Application&lt;br&gt;
Let's say you have a user verification process where you need to send an OTP (One-Time Password) to the user's email. Here's an example of how you can integrate the SendMail function into your application:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbhyk0opd5tcjbyog9ex2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbhyk0opd5tcjbyog9ex2.png" alt="Image description" width="800" height="1379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 4: Create an Endpoint to Trigger Email Sending&lt;br&gt;
Finally, you need an endpoint to trigger the email sending. Here is an example using the Gin framework:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fed4qf5qdft371cexr7m2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fed4qf5qdft371cexr7m2.png" alt="Image description" width="800" height="791"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foyy2roc73pz3u9msm5oe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foyy2roc73pz3u9msm5oe.png" alt="Image description" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In your server setup, register this endpoint:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbjjxfqpd524w1b2hdsqc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbjjxfqpd524w1b2hdsqc.png" alt="Image description" width="800" height="583"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With this setup, you can now send emails from your Go application using the SendMail function. This method ensures your credentials are secure and that your email sending logic is cleanly separated from the rest of your application.&lt;/p&gt;

&lt;p&gt;Feel free to customize the code and the explanations according to your specific requirements and style preferences!&lt;/p&gt;

&lt;p&gt;Link to the Full code&lt;br&gt;
&lt;a href="https://github.com/gbubemi22/goSetup" rel="noopener noreferrer"&gt;https://github.com/gbubemi22/goSetup&lt;/a&gt;&lt;/p&gt;

</description>
      <category>go</category>
    </item>
    <item>
      <title>URL Shortener Service for your API</title>
      <dc:creator>oritsegbubemi</dc:creator>
      <pubDate>Mon, 04 Oct 2021 15:02:45 +0000</pubDate>
      <link>https://dev.to/gbubemi22/url-shortener-service-for-your-api-1o35</link>
      <guid>https://dev.to/gbubemi22/url-shortener-service-for-your-api-1o35</guid>
      <description>&lt;p&gt;&lt;a href="https://twitter.com/Rapid_API/status/1445008466817568773?s=20" rel="noopener noreferrer"&gt;https://twitter.com/Rapid_API/status/1445008466817568773?s=20&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>HTTP status code are pretty confusing sometimes ... check the link below</title>
      <dc:creator>oritsegbubemi</dc:creator>
      <pubDate>Mon, 04 Oct 2021 15:00:36 +0000</pubDate>
      <link>https://dev.to/gbubemi22/http-status-code-are-pretty-confusing-sometimes-check-the-link-below-11k7</link>
      <guid>https://dev.to/gbubemi22/http-status-code-are-pretty-confusing-sometimes-check-the-link-below-11k7</guid>
      <description>&lt;p&gt;&lt;a href="https://twitter.com/Rapid_API/status/1444026755363348488?s=20" rel="noopener noreferrer"&gt;https://twitter.com/Rapid_API/status/1444026755363348488?s=20&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>it is good to be hear</title>
      <dc:creator>oritsegbubemi</dc:creator>
      <pubDate>Thu, 30 Sep 2021 17:01:17 +0000</pubDate>
      <link>https://dev.to/gbubemi22/it-is-good-to-be-hear-451k</link>
      <guid>https://dev.to/gbubemi22/it-is-good-to-be-hear-451k</guid>
      <description>&lt;p&gt;what i love doing&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
