Skip to content
View IacopoMelani's full-sized avatar
🍸
🍸
  • Italy

Organizations

@music-gang
Block or Report

Block or report IacopoMelani

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
IacopoMelani/README.md
# me.yaml
name: Iacopo
from: Italy
based: Somewhere in the Cloud
role: Backend Developer
nick: Santiago
languages:
  - lang: Go
    affinity: 90
  - lang: PHP
    affinity: 80
  - lang: Rust
    affinity: WIP
databases:
  - MariaDB
  - PostgreSQL
  - Redis
miscs:
  - Docker
  - Kubernetes
  - Terraform
  - Nomad
hobbies:
  - Videogames
  - Gin Tonic
  - Coding
  - Repeat
package main

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"

	"gopkg.in/yaml.v2"
)

type Person struct {
	Name      string   `json:"name"      yaml:"name"`
	From      string   `json:"from"      yaml:"from"`
	Based     string   `json:"based"     yaml:"based"`
	Role      string   `json:"role"      yaml:"role"`
	Nick      string   `json:"nick"      yaml:"nick"`
	Langs     []Lang   `json:"languages" yaml:"languages"`
	Databases []string `json:"databases" yaml:"databases"`
	Miscs     []string `json:"miscs"     yaml:"miscs"`
	Hobbies   []string `json:"hobbies"   yaml:"hobbies"`
}

type Lang struct {
	Name     string `json:"lang"     yaml:"lang"`
	Affinity int    `json:"affinity" yaml:"affinity"`
}

func main() {

	var me Person

	yamlFile, err := ioutil.ReadFile("me.yaml")
	if err != nil {
		panic(err)
	}

	if err := yaml.Unmarshal(yamlFile, &me); err != nil {
		panic(err)
	}

	http.HandleFunc("/me", func(rw http.ResponseWriter, r *http.Request) {
		rw.Header().Set("Content-Type", "application/json")
		rw.WriteHeader(http.StatusOK)

		contentJson, err := json.Marshal(me)
		if err != nil {
			log.Fatal(err)
		}

		rw.Write([]byte(contentJson))
	})

	fmt.Println("Listening on :8080")

	log.Fatal(http.ListenAndServe(":8080", nil))
}

Pinned Loading

  1. music-gang/music-gang-api music-gang/music-gang-api Public

    Music Gang, the modest FaaS

    Go

  2. Go-Starter-Project Go-Starter-Project Public template

    Template of a generic project written in go

    Go 1 5

  3. the-blockchain-pub the-blockchain-pub Public

    Forked from https://github.com/web3coach/the-blockchain-bar

    Go

  4. Simple and portable queue manager fo... Simple and portable queue manager for handle promises sequentially
    1
    import { Err, Error, ErrorCode, newError, Result } from "./util"
    2
    
                  
    3
    type JobCall<T> = () => Promise<Result<T, Error>>
    4
    type JobResolver<T> = (result: T) => void
    5
    type JobRejector = (error: Error) => void
  5. sviluppiamotutto/gompile.sh sviluppiamotutto/gompile.sh Public

    A simple script to compile and archive Go binaries.

    Shell 2