|
|
@ -5,16 +5,16 @@ import (
|
|
|
|
"net/http"
|
|
|
|
"net/http"
|
|
|
|
"net/url"
|
|
|
|
"net/url"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mongodbstore "github.com/2-72/gorilla-sessions-mongodb"
|
|
|
|
"github.com/go-chi/chi"
|
|
|
|
"github.com/go-chi/chi"
|
|
|
|
"github.com/gorilla/sessions"
|
|
|
|
"github.com/gorilla/sessions"
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
|
|
|
|
"github.com/unrolled/render"
|
|
|
|
spotifyauth "github.com/zmb3/spotify/v2/auth"
|
|
|
|
spotifyauth "github.com/zmb3/spotify/v2/auth"
|
|
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
|
|
"go.mongodb.org/mongo-driver/mongo/options"
|
|
|
|
"go.mongodb.org/mongo-driver/mongo/options"
|
|
|
|
"golang.org/x/oauth2"
|
|
|
|
"golang.org/x/oauth2"
|
|
|
|
"gopkg.in/mgo.v2"
|
|
|
|
"gopkg.in/mgo.v2"
|
|
|
|
|
|
|
|
|
|
|
|
mongodbstore "github.com/2-72/gorilla-sessions-mongodb"
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type App struct {
|
|
|
|
type App struct {
|
|
|
@ -24,6 +24,7 @@ type App struct {
|
|
|
|
SpotifyOAuthConfig *oauth2.Config
|
|
|
|
SpotifyOAuthConfig *oauth2.Config
|
|
|
|
Mux *chi.Mux
|
|
|
|
Mux *chi.Mux
|
|
|
|
SessionStore sessions.Store
|
|
|
|
SessionStore sessions.Store
|
|
|
|
|
|
|
|
Render *render.Render
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a App) Run() {
|
|
|
|
func (a App) Run() {
|
|
|
@ -81,12 +82,15 @@ func NewApp() *App {
|
|
|
|
|
|
|
|
|
|
|
|
mux := NewMux()
|
|
|
|
mux := NewMux()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r := render.New()
|
|
|
|
|
|
|
|
|
|
|
|
app := &App{
|
|
|
|
app := &App{
|
|
|
|
MongoClient: client,
|
|
|
|
MongoClient: client,
|
|
|
|
SpotifyAuth: auth,
|
|
|
|
SpotifyAuth: auth,
|
|
|
|
SpotifyOAuthConfig: authConfig,
|
|
|
|
SpotifyOAuthConfig: authConfig,
|
|
|
|
Mux: mux,
|
|
|
|
Mux: mux,
|
|
|
|
SessionStore: store,
|
|
|
|
SessionStore: store,
|
|
|
|
|
|
|
|
Render: r,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return app
|
|
|
|
return app
|
|
|
|