controller

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RestApiModuleProcessor

func RestApiModuleProcessor()

Types

type CjFaker

type CjFaker struct {
	Generator *rand.Rand
}

func New

func New() (f CjFaker)

func NewWithSeed

func NewWithSeed(src rand.Source) (f CjFaker)

func (*CjFaker) IntBetween

func (f *CjFaker) IntBetween(min, max int) int

func (*CjFaker) JobTitle

func (f *CjFaker) JobTitle() string

func (*CjFaker) RandomStringElement

func (f *CjFaker) RandomStringElement(s []string) string

type Controller

type Controller struct {
	Router     *mux.Router
	Repository *repositories.Repository
}

Controller Controller structure

func NewAPIController

func NewAPIController(router *mux.Router, repo repositories.Repository) *Controller

NewAPIController Creates a new controller

func (*Controller) DeleteArticle

func (c *Controller) DeleteArticle(w http.ResponseWriter, r *http.Request)

DeleteArticle Deletes an article from the database

func (*Controller) Generator

func (c *Controller) Generator(w http.ResponseWriter, r *http.Request)

Login Generate a token for a valid user

func (*Controller) GetAllArticles

func (c *Controller) GetAllArticles(w http.ResponseWriter, r *http.Request)

GetAllArticles Gets all the articles from the database

func (*Controller) GetArticle

func (c *Controller) GetArticle(w http.ResponseWriter, r *http.Request)

GetArticle Gets an article by it's id from the database

func (*Controller) Hello

func (c *Controller) Hello(w http.ResponseWriter, r *http.Request)

Login Generate a token for a valid user

func (*Controller) Login

func (c *Controller) Login(w http.ResponseWriter, r *http.Request)

Login Generate a token for a valid user

func (*Controller) PostArticle

func (c *Controller) PostArticle(w http.ResponseWriter, r *http.Request)

PostArticle Post new article into database

func (*Controller) PutArticle

func (c *Controller) PutArticle(w http.ResponseWriter, r *http.Request)

PutArticle Updates an article in the database

func (*Controller) Validate

func (c *Controller) Validate(w http.ResponseWriter, r *http.Request)

Validate Validate a token for a valid user

type TestResponse

type TestResponse struct {
	Message string
	Token   string `json:"authToken,omitempty"`
}

Jump to

Keyboard shortcuts

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