bnkamalesh / goapp Goto Github PK
View Code? Open in Web Editor NEWAn opinionated guideline to structure & develop a Go web application/service
License: MIT License
An opinionated guideline to structure & develop a Go web application/service
License: MIT License
First of all thanks @bnkamalesh for the excellent repo. We looked at many golang web boilerplates and this was the best we found!
Since in real world we will have many domains, wont the number of args to api.NewService become very large? What is a clean way to manage this?
For eg:
type API struct {
logger logger.Logger
users *users.Users
notes *notes.Notes
blogs *blogs.Blogs
subscriptions *subs.Subscriptions
// ...
}
and the corresponding NewService
like this:
// NewService returns a new instance of API with all the dependencies initialized
func NewService(l logger.Logger, us *users.Users, ns *notes.Notes, bs *blogs.Blogs, ss *subs.Subscriptions) (*API, error) {
return &API{
logger: l,
users: us,
}, nil
}
Hi Kamaleshwar,
First of all big thanks the great work you have put here. For someone just starting with go and with the amount of suggestions there I liked the level of details here and the explanation and I find That all make sense to me. That will be awesome to see how you do integration tests also and what do you think about the necessity (or not) of unit-testing (vs interface pollution).
This is an issue that came up in our own internal (private, sorry) app for which I've not found a good sample (though not having much time / priority to research.)
Let's say we want to have a service providing the following. Including some imaginary dependencies that are unique to each:
In its current form everything is in a single module and so any dependencies needed anywhere will become (indirect) dependencies to the clients, and if you're running security checks over your dependencies you can get flagged that your API client (which is not much more than a glorified http client) has a potential vulnerability due to a database driver/SAML/OpenTelemetry/LLMs -- any other library really -- which are implementation details of the server only and shouldn't really even be visible to the (http) clients.
I believe properly hiding the implementation details would require at least two, maybe three modules with different dependencies sets which isn't entirely trivial to set up (and harder to refactor into afterwards) and a blueprint would be helpful.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.