This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package app | |
import ( | |
"net/http" | |
u "lens/utils" | |
"strings" | |
"go-contacts/models" | |
jwt "github.com/dgrijalva/jwt-go" | |
"os" | |
"context" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package models | |
import ( | |
_ "github.com/jinzhu/gorm/dialects/postgres" | |
"github.com/jinzhu/gorm" | |
"os" | |
"github.com/joho/godotenv" | |
"fmt" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/gorilla/mux" | |
"go-contacts/app" | |
"os" | |
"fmt" | |
"net/http" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package models | |
import ( | |
"github.com/dgrijalva/jwt-go" | |
u "lens/utils" | |
"strings" | |
"github.com/jinzhu/gorm" | |
"os" | |
"golang.org/x/crypto/bcrypt" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import ( | |
"net/http" | |
u "go-contacts/utils" | |
"go-contacts/models" | |
"encoding/json" | |
) | |
var CreateAccount = func(w http.ResponseWriter, r *http.Request) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package models | |
import ( | |
u "go-contacts/utils" | |
"github.com/jinzhu/gorm" | |
"fmt" | |
) | |
type Contact struct { | |
gorm.Model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import ( | |
"net/http" | |
"go-contacts/models" | |
"encoding/json" | |
u "go-contacts/utils" | |
"strconv" | |
"github.com/gorilla/mux" | |
"fmt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utils | |
import ( | |
"encoding/json" | |
"net/http" | |
) | |
func Message(status bool, message string) (map[string]interface{}) { | |
return map[string]interface{} {"status" : status, "message" : message} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
events { | |
worker_connections 1024; | |
} | |
http { | |
server_tokens off; | |
server { | |
listen 80; | |
location /api/account { |
OlderNewer