Skip to content

Exemple of the handling of a http request : Is there a way to abstract away the store definition ? (or « can a method return an object of type Store?) #566

Discussion options

You must be logged in to vote

Exemple of the handling of a http request : Is there a way to abstract away the store definition

The mint-realworld repository contains a reusable version of HTTP call: https://github.com/mint-lang/mint-realworld/blob/master/source/Api.mint Basically there is a type Api.Status(a) and a module that has functions that relate to that type.

Question : Is there an approach, using Mint, to a avoid rewriting the snippet hereunder over and over again (one for each URL), like a function taking a URL as an argument an returning the corresponding "store" object?

Alternatively, does the "constructor" of a store object accept parameters (say, like the constructor of a class in Crystal, for instance)?

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by gdotdesign
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants