Skip to content

Instantly share code, notes, and snippets.

View adigunhammedolalekan's full-sized avatar
🎯
Working Remotely

Hammed Adigun adigunhammedolalekan

🎯
Working Remotely
View GitHub Profile
package app
import (
"net/http"
u "lens/utils"
"strings"
"go-contacts/models"
jwt "github.com/dgrijalva/jwt-go"
"os"
"context"
@adigunhammedolalekan
adigunhammedolalekan / base.go
Created May 3, 2018 11:49
Connect to a postgresql database using GORM
package models
import (
_ "github.com/jinzhu/gorm/dialects/postgres"
"github.com/jinzhu/gorm"
"os"
"github.com/joho/godotenv"
"fmt"
)
package main
import (
"github.com/gorilla/mux"
"go-contacts/app"
"os"
"fmt"
"net/http"
)
package models
import (
"github.com/dgrijalva/jwt-go"
u "lens/utils"
"strings"
"github.com/jinzhu/gorm"
"os"
"golang.org/x/crypto/bcrypt"
)
package controllers
import (
"net/http"
u "go-contacts/utils"
"go-contacts/models"
"encoding/json"
)
var CreateAccount = func(w http.ResponseWriter, r *http.Request) {
package models
import (
u "go-contacts/utils"
"github.com/jinzhu/gorm"
"fmt"
)
type Contact struct {
gorm.Model
package controllers
import (
"net/http"
"go-contacts/models"
"encoding/json"
u "go-contacts/utils"
"strconv"
"github.com/gorilla/mux"
"fmt"
package utils
import (
"encoding/json"
"net/http"
)
func Message(status bool, message string) (map[string]interface{}) {
return map[string]interface{} {"status" : status, "message" : message}
}
@adigunhammedolalekan
adigunhammedolalekan / RoomExample.java
Created February 17, 2019 18:21
Room, LiveData example
// this file is just a pseudo code of the whole idea
// we have 3 entities - Booking, User and Address(Origin and Destination)
// example userDao
class UserDao {
public User getUser(int id);
}
events {
worker_connections 1024;
}
http {
server_tokens off;
server {
listen 80;
location /api/account {