Documentation ¶
Index ¶
- Constants
- func ConfigurationFile() (string, error)
- func Connect() (*sql.DB, error)
- func Create(w http.ResponseWriter, r *http.Request)
- func Delete(w http.ResponseWriter, r *http.Request)
- func Get(w http.ResponseWriter, r *http.Request)
- func GetAll(w http.ResponseWriter, r *http.Request)
- func HandleArticle(w http.ResponseWriter, r *http.Request)
- func HandleRequests()
- func HomePage(w http.ResponseWriter, r *http.Request)
- func Update(w http.ResponseWriter, r *http.Request)
- type Article
- type Configuration
Constants ¶
View Source
const ( PACKAGE_NAME = "restserver" YAML_FILE_NAME = "config.yml" )
Variables ¶
This section is empty.
Functions ¶
func ConfigurationFile ¶
ConfigurationFile returns the fully qualified name of the YAML file.
func Create ¶
func Create(w http.ResponseWriter, r *http.Request)
Create adds a new article to the collection, based on JSON data contained in the request. This is a POST method.
func Delete ¶
func Delete(w http.ResponseWriter, r *http.Request)
Delete gets an article number from the request and deletes the corresponding article in the collection. This is a DELETE method.
func Get ¶
func Get(w http.ResponseWriter, r *http.Request)
Get gets an article number from the request and returns the corresponding article in the collection.
func GetAll ¶
func GetAll(w http.ResponseWriter, r *http.Request)
GetAll returns the entire articles collection
func HandleArticle ¶ added in v1.1.0
func HandleArticle(w http.ResponseWriter, r *http.Request)
func HandleRequests ¶
func HandleRequests()
HandleRequests registers all the routers and starts the server.
Types ¶
type Configuration ¶
type Configuration struct { HOST string `json:"host"` PORT int `json:"port"` DBNAME string `json:"dbname"` DBSQL string `json:"dbsql"` }
func NewConfiguration ¶
func NewConfiguration() (*Configuration, error)
NewConfiguration creates a configuration structure from the YAML file in the user configuration directory.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.