server

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package server is used to create, and run a new, initialized server instance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host string // Host to run the server on.
	Port string // Port to run the server on.
}

Config holds server's configuration options.

type SearchIn

type SearchIn struct {
	Datastore *sql.DB // Datastore to search in.
	BookTable string  // Table to search in.
}

SearchIn Contains a database and name of the table to search in. It is a copy of package books's SearchIn struct created to prevent importing of books package into main to limit dependency.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server represents bfr's http server, and holds all dependencies needed for a server to run.

func New

func New(config *Config, searchIn *SearchIn) *Server

New creates and returns a new, initialized server instance with handlers pointing to correct routes.

func (*Server) Run

func (s *Server) Run()

Run runs a server instance on the host and port specified in its config.

Jump to

Keyboard shortcuts

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