no-framework

command module
v0.0.0-...-534cd08 Latest Latest
Warning

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

Go to latest
Published: May 17, 2020 License: MIT Imports: 1 Imported by: 0

README

Basic Dependency Injection in Go

Basic DI implemented using Go, no third-party DI framework.

Overview

Here is a simple implementation of a database-driven API server. The pkg directory contains the typical components that support such application. Here's a breakdown:

  • models.go - The main data model City and its corresponding Factory and support functions.
  • datastore.go - The persistence layer representing the data store. It contains the DataStore and its corresponding Factory and data access functions.
  • server.go - The server that serves an RESTful endpoint over HTTP. It contains the HTTPServer and its corresponding Factory and route handler functions.
  • settings.go - Settings the runtime settings that we want to pass to the above components during construction and initialization at runtime.

Setup

  1. Run the program

    $ go run main.go
    
  2. On another shell

    $ curl localhost:8000
    

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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