Ejemplo n.º 1
0
func main() {
	defer db.Close()
	godotenv.Load()

	if os.Getenv("ENV") != "production" {
		factory.AutoMigrate()
		s3s.Test()
	} else {
		log.Println("Production")
	}

	log.Fatal(http.ListenAndServe(":"+os.Getenv("PORT"), api_srv.New()))
}
Ejemplo n.º 2
0
	// "github.com/triitvn/instagram-go/api/models/factory"

	"bytes"
	"encoding/json"
	// "fmt"
	"net/http"
	"net/http/httptest"
	"strings"
	"testing"

	"io/ioutil"
	"mime/multipart"
	"os"
)

var apiSrv = api_srv.New()

var _ = BeforeSuite(func() {
	// factory.AutoMigrate()
	path, _ := os.Getwd()
	path += "/routes.go"

})

func TestApiSrv(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "ApiSrv Suite")
}

func Request(method string, path string, body string) *httptest.ResponseRecorder {
	request, _ := http.NewRequest(method, path, strings.NewReader(body))