goctapusmongo

package module
v0.0.0-...-386751c Latest Latest
Warning

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

Go to latest
Published: May 23, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

README

Gocatpus

goctapus logo

Goctapus is a wrapper around Echo that makes it easier to build REST APIs and applications that are based on them.

It implements a TODO App for demonstration purposes but it can be easily converted into any kind of application.

This repository was originaly a fork of ezynda3/go-echo-vue but it is now using MySQL instead of SQLite3 for the Database and it's purpose is to abstract as many things as possible to make the development of web applications as fast and easy as possible.

To get it running using Docker:
1. Clone this repository
git clone https://github.com/Kamaropoulos/goctapus.git && cd goctapus
2. Build and run it using Docker Compose
docker-compose up -d
If you don't have Docker installed:
1. Clone this repository
git clone https://github.com/Kamaropoulos/goctapus.git && cd goctapus
2. Run the server using your MySQL Database connection information
go run main.go [application_Port] [DB_Username] [DB_Password] [DB_Hostname/IP] [DB_PORT]

where you'll have to replace:

  • [application_Port] with the port you want the application to listen to,
  • [DB_Username] with the username the application is going to connect to the Database with,
  • [DB_Password] with the password the application is going to connect to the Database with,
  • [DB_Hostname/IP] with the hostname or the IP the Database is running on,
  • [DB_Port] with the Port the Database is listening to.
To try the application, point your browser to http://localhost:[applicationPort]

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Database *mgo.Session

Functions

func ConnectDB

func ConnectDB(config Configuration) *mgo.Session

func DELETE

func DELETE(path string, handler echo.HandlerFunc, m ...echo.MiddlewareFunc)

func File

func File(path, file string)

func GET

func GET(path string, handler echo.HandlerFunc, m ...echo.MiddlewareFunc)

func Init

func Init(args []string, logLevel string, database string)

func InitDB

func InitDB(dbString string) *sql.DB

InitDB initializes the connection to the Database

func InitLogger

func InitLogger(logLevel string)

func POST

func POST(path string, handler echo.HandlerFunc, m ...echo.MiddlewareFunc)

func PUT

func PUT(path string, handler echo.HandlerFunc, m ...echo.MiddlewareFunc)

func SetLogLevel

func SetLogLevel(level string)

func Start

func Start()

Types

type Configuration

type Configuration struct {
	// contains filtered or unexported fields
}
var Config Configuration

Jump to

Keyboard shortcuts

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