adhocteam / pushup

Pushup is for making modern, page-oriented web apps in Go
https://pushup.adhoc.dev
MIT License
844 stars 30 forks source link

Make Pushup apps easy to import into larger Go projects #47

Open paulsmith opened 2 years ago

paulsmith commented 2 years ago

Pushup compiles down to Go code in its own package that should be easy to import in other Go projects that would like to get the features Pushup provides. Right now the reality is it's a little messy to do that.

This is a tracking issue but I think there are 3 things necessary to make this a reality:

  1. URL routing - right now Pushup assumes it is at the root of a URL path. This should be straightforward to deal with with http.ServeMux and http.StripPrefix, but there should be an API for it.
  2. Setup code in main.go - in _runtime/cmd/main.go is code for importing from the build directory and running a Pushup app as a standard Go http server. This should be factored out into its own API.
  3. More control over output & build dir - we haven't exercised the controls for specifying non-default output params. This includes the build directory location, as well as the ability to specify the name of the generated Go package (this is in fact not exposed yet).

Then I think we need an example project that demonstrates a Pushup app can be imported like a regular Go package/module.