Skip to content

Instantly share code, notes, and snippets.

View victorsteven's full-sized avatar

Victor Steven victorsteven

View GitHub Profile
@victorsteven
victorsteven / .env
Created August 27, 2019 13:21
The .env file
# 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
package channels
func OK(done <-chan bool) bool {
select {
case ok := <-done:
if ok {
return true
}
}
return false
package models
import (
"errors"
"html"
"log"
"strings"
"time"
"github.com/badoux/checkmail"
package models
import (
"errors"
"html"
"strings"
"time"
"github.com/jinzhu/gorm"
)
package controllers
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"strconv"
package controllers
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"strconv"
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
package seed
import (
"log"
"github.com/jinzhu/gorm"
"github.com/victorsteven/fullstack/api/models"
)
var users = []models.User{
package api
import (
"fmt"
"log"
"os"
"github.com/joho/godotenv"
"github.com/victorsteven/fullstack/api/controllers"
"github.com/victorsteven/fullstack/api/seed"
package main
import "github.com/victorsteven/fullstack/api"
func main() {
api.Run()
}