api

module
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: MIT

README ΒΆ

GridStream API

api to allow frontend to communicate with database

🧭 Table of Contents

πŸ‘₯ Team

Team Member Role Title Description
Matthew Collett Technical Lead/Developer Focus on architecture design and solving complex problems, with a focus on the micro-batching process.
Cooper Dickson Project Manager/Developer Ensure that the scope and timeline are feasible and overview project status, focus on UI and real-time transmission.
Eric Cuenat Scrum Master/Developer In charge of agile methods for the team such as organizing meetings, removing blockers, and team communication, focus on UI and web socket interaction.
Sam Keays Product Owner/Developer Manager of product backlog and updating board to reflect scope changes and requirements, focus on database operations and schema design.

πŸ—οΈ Directory Structure

api/
β”œβ”€β”€ cmd/
β”‚   └── api/
β”‚       └── main.go
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ handlers/
β”‚   β”‚   β”œβ”€β”€ middlewares/
β”‚   β”‚   β”œβ”€β”€ repositories/
β”‚   β”‚   β”œβ”€β”€ server/
β”‚   β”‚   β”‚    └── routes.go
β”‚   β”‚   β”‚    └── server.go
β”‚   β”‚   β”œβ”€β”€ models/
β”‚   β”‚   └── logic/
β”‚   └── config/
β”‚       └── config.go
β”œβ”€β”€ pkg/
└── tests/
    β”œβ”€β”€ integration/
    └── unit/
  • cmd/api/main.go

    • Entry point of the application where we set up the HTTP server and wire up components. Runs HTTP server created by server.go in a goroutine.
  • internal/app Contains the core application logic, organized into subfolders

    • handlers/
      • Handle the HTTP request; validate schema, apply business logic from logic package (optional), uses repository package to insert and returns response.
    • middlewares/
      • Optional functions that can be applied to HTTP requests. For example, making sure a user is authenticated. (Adapter pattern).
    • repositories/
      • Data access layer that interacts directly with the database. Called from handler package and returns response.
    • logic/
      • Holds complex business logic that needs to be applied to data if necessary.
    • models/
      • Contains structs representing database schemas. Can be used to insert into database and validate schemas.
    • server/ Contains initialization for server and registering routes.
      • server.go
        • Creates and returns server struct for main.go to run. Calls routes.go to register routes for requests.
      • routes.go
        • Initializes router, registers routes and applies necessary middleware to requests. Called by server.go
  • internal/config/config.go

    • Holds Application configuration, such as database connection details, API keys, etc.
  • pkg

    • Holds reusuable libraries to be used accross different projects. Example, Firebase client, Big Query client, generic logger
  • tests

    • Unit and integration tests related to the application.

⛑️ Contributing

TODO

πŸš€ Local Run

TODO - update makefile

  • Navigate to root directory of repository
  • Run go mod download to download packages
  • Run make run to run api
Prerequisites

Directories ΒΆ

Path Synopsis
cmd
api
internal
app/middlewares
this middleware is for blocking bots from trying to access sensitive files I am sick of these bots, in the future if we have time, we can set up a load balancer and attach firewalls but this will do for now
this middleware is for blocking bots from trying to access sensitive files I am sick of these bots, in the future if we have time, we can set up a load balancer and attach firewalls but this will do for now
app/server
Defines Routes and Middleware
Defines Routes and Middleware
pkg

Jump to

Keyboard shortcuts

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