core

package
v0.0.0-...-5024c58 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const AV1 = "/api/v1"

Variables

This section is empty.

Functions

func LoadEnv

func LoadEnv()

LoadEnv loads the file ".env" with the environment variables

Types

type Server

type Server struct {
	Router *mux.Router
	User   *mux.Router
	Admin  *mux.Router
}

Server contains all the necessary information to initialize and use the server

Rouer is the base router, it SHOULDN'T be used, create a subrouter instead, e.g. User and admin subrouters

DB is a pointer to a struct that contains the database models

func (*Server) CreateRoutes

func (s *Server) CreateRoutes()

func (*Server) Initialize

func (s *Server) Initialize(_user, _password, _dbHost string, _dbName string)

Initialize does the server setup in the following order:

Router initialization, AddSelect of user and admin subroutes to the router, Connect to database, Database initialization, Cache initialization, Creation of routes

NOTE: the initialization of the database MUST be done before the cache initialization

func (*Server) Run

func (s *Server) Run(_addr string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL