Haris3243 / simple-server

This repository contains a simple server written in golang, which can handle a simple request and by consuming enviroment variable return the value or variable by concatenating it with Hello

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple APIServer in Golang

This is the first basic example of a server in which a single API is defined which says the hello by obtaining value from environment variable MYNAME and concatenates it with Hello. for example if value of MYNAME in environment variable is Haris then when a call is made to this API it returns Hello Haris

to start with this basic implementation of a server in golang lets follow these steps after cloning the repository

Compilation

  • Go to the folder where you have clone this repository.
  • open terminal and run the following command
        go build ./src/main.go
    
    

This will generates an executable in folder by name "main"

Building Docker Image

to build docker image of the server application run the following command

        docker build -t server:latest .

Above command will create and image and you can verify it by getting your image list from command

        docker images

Using Kubernetes Deployment

to deploy it using kubernetes deployment resource,use following command

    kubectl create -f deployment.yml

About

This repository contains a simple server written in golang, which can handle a simple request and by consuming enviroment variable return the value or variable by concatenating it with Hello


Languages

Language:Go 60.4%Language:Dockerfile 39.6%