This file contains hidden or 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
| # Postgres Live | |
| DB_HOST=127.0.0.1 | |
| DB_DRIVER=postgres | |
| API_SECRET=98hbun98h #This is used when creating a JWT. It can be anything you want | |
| DB_USER=username | |
| DB_PASSWORD=password | |
| DB_NAME=fullstack_api | |
| DB_PORT=5432 #Default postgres port | |
| # Postgres Test |
This file contains hidden or 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 channels | |
| func OK(done <-chan bool) bool { | |
| select { | |
| case ok := <-done: | |
| if ok { | |
| return true | |
| } | |
| } | |
| return false |
This file contains hidden or 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 ( | |
| "errors" | |
| "html" | |
| "log" | |
| "strings" | |
| "time" | |
| "github.com/badoux/checkmail" |
This file contains hidden or 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 ( | |
| "errors" | |
| "html" | |
| "strings" | |
| "time" | |
| "github.com/jinzhu/gorm" | |
| ) |
This file contains hidden or 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 ( | |
| "encoding/json" | |
| "errors" | |
| "fmt" | |
| "io/ioutil" | |
| "net/http" | |
| "strconv" |
This file contains hidden or 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 ( | |
| "encoding/json" | |
| "errors" | |
| "fmt" | |
| "io/ioutil" | |
| "net/http" | |
| "strconv" |
This file contains hidden or 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 "github.com/victorsteven/fullstack/api/middlewares" | |
| func (s *Server) initializeRoutes() { | |
| // Home Route | |
| s.Router.HandleFunc("/", middlewares.SetMiddlewareJSON(s.Home)).Methods("GET") | |
| // Login Route |
This file contains hidden or 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 seed | |
| import ( | |
| "log" | |
| "github.com/jinzhu/gorm" | |
| "github.com/victorsteven/fullstack/api/models" | |
| ) | |
| var users = []models.User{ |
This file contains hidden or 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 api | |
| import ( | |
| "fmt" | |
| "log" | |
| "os" | |
| "github.com/joho/godotenv" | |
| "github.com/victorsteven/fullstack/api/controllers" | |
| "github.com/victorsteven/fullstack/api/seed" |
This file contains hidden or 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/victorsteven/fullstack/api" | |
| func main() { | |
| api.Run() | |
| } |