volatiletech / abcweb Goto Github PK
View Code? Open in Web Editor NEWGo web app framework and generator. Inspired by Rails.
License: BSD 3-Clause "New" or "Revised" License
Go web app framework and generator. Inspired by Rails.
License: BSD 3-Clause "New" or "Revised" License
Dependencies aren't installed, so when building app it takes over a minute. Run 'go install' on generated app as final step.
Once SQLBoiler supports SQLite it will allow ABCWeb to function out of the box by utilizing its own SQLite database, instead of having the requirement to set up or configure Postgres or MySQL.
We will also need to add SQLite to the mig package.
Pointing to where middlewares are created/added (app/setup.go NewMiddleware func)
abcweb deps
should only install gulp and the deps tool. The rest of the dependencies should be fetched by dep itself in the dep ensure
stage.
When running abcweb new
it does not appear to be outputting dep ensure
errors correctly, even in verbose mode, however it should output errors when not in verbose mode as well.
The abcweb framework is the exact infrastructure that we are looking for in the golang full stack development environment. We are trying to put the RESTful API implementation, like the go-chi/chi style. This can easily work. But, each of API request has to be validated against the authenticated login session. I spotted that several places to enforce the session management:
In the NewRouter(), where creates the application routes, that binds with
root := controllers.Root{
Render: a.Render,
Session: a.Session,
}
which implicates the Controller is the place to implement such logic, right? I wonder how to add the session validation with the API processing that defines in the router.Route(...). Any sample codes or application can be real helpful.
Thanks. Nice framework!
-Richard
I had to do some additional stuff to start a new projects (on macosx)
brew install postgresql
brew services start postgresql
createuser -P myapp
createdb myapp
n/a
Env:
Windows 10 64bit
Go 1.8.3 64bit
Step to introduce:
Expected:
Application generate new project
Result:
Failed with error: cannot locate base path containing templates folder
Output:
$ abcweb new gitlab.com/xxx/cashkit/
Your GOPATH has multiple paths, select your desired GOPATH:
[1] C:\Users\Airlangga\Projects\cashkit
[2] C:\Users\Airlangga\Application\go-base
Select GOPATH number: 1
1
Generating in: C:\Users\Airlangga\Projects\cashkit\src\gitlab.com\xxx\cashkit
Error: cannot locate base path containing templates folder
Usage:
abcweb new <import_path> [flags]
Examples:
abcweb new github.com/yourusername/myapp
... *cutout to reduce noise
$ echo %GOPATH%
C:\Users\Airlangga\Projects\cashkit;C:\Users\Airlangga\Application\go-base
Mac OSX already has a mig
(Mach Interface Generator tool) executable in /usr/bin
. This hinders abcweb
from installing and calling volatiletech/mig
> abcweb migrate status
error: cannot read file status
Error: exit status 1
Usage:
abcweb migrate status [flags]
Flags:
-h, --help help for status
Global Flags:
--db string Valid options: postgres|mysql (default: "config.toml db field")
-e, --env string The config.toml file environment to load (default "dev")
Hello,
I'm getting excited about this project coming from a Rails background. Migrations don't seem to work as stated in the current documentation:
$ abcweb gen migration add_app_owners
error: cannot read file create
Error: exit status 1
Usage:
abcweb gen migration <name> [flags]
Examples:
abcweb gen migration add_users
Flags:
-h, --help help for migration
This is an obvious show stopper for a beginner in abcweb or anyone, like myself, who's evaluating current Go frameworks for their next project.
Any ideas? I have my $GOPATH/bin first in my $PATH. (thought I'd mention it since there is another issue opened related to migrations currently)
Keep up the good work! Very exciting. Looking forward to evaluating again at some point.
Adam
Chi repo has released v3 and moved to https://github.com/go-chi/chi
Update all imports and the Gokpkg.toml and ensure API consistency.
I tried using the websocket library(melody) as well as other libraries but they don't work with abcweb. The websocket connection never opens. I also tried melody
in a simple setup with chi router and it worked.
package main
import (
"github.com/go-chi/chi"
"gopkg.in/olahol/melody.v1"
"net/http"
)
func main() {
r := chi.NewRouter()
m := melody.New()
r.Get("/ws", func(w http.ResponseWriter, r *http.Request) {
m.HandleRequest(w, r)
})
m.HandleMessage(func(s *melody.Session, msg []byte) {
m.Broadcast(msg)
})
http.ListenAndServe(":3000", r)
}
I add the code below to the router in my abcweb router file and it doesn't work. Please can I get help on this issue?
router.Get("/ws", func(w http.ResponseWriter, r *http.Request) {
m.HandleRequest(w, r)
})
My Repo: https://github.com/fadeojo/brito
Would love to see a comparison of this vs Go Buffalo and why one would choose either. gobuffalo.io/
This is the second time that I stumble on this project. I sent you a PR few days ago. There is something that annoyed me in your API. Some of your packages are prefix by ABC
for no obvious reason. I think that removing this prefix will increase the readability and reduce the typing.
This is close from bikeshedding so feel free to ignore it and just close this issue :-).
Review patch:
+++ b/vendor/github.com/volatiletech/abcweb/abcserver/server.go
@@ -1,6 +1,7 @@
package abcserver
import (
+ "bytes"
"context"
"crypto/tls"
"fmt"
@@ -9,6 +10,7 @@ import (
"net/http"
"os"
"os/signal"
+ "strings"
"github.com/go-chi/chi"
"github.com/pkg/errors"
@@ -108,13 +110,23 @@ func Redirect(cfg abcconfig.ServerConfig, logger *zap.Logger) {
ErrorLog: log.New(serverErrLogger{logger}, "", 0),
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Remove port if it exists so we can replace it with https port
- var httpHost string
- httpHost, _, err = net.SplitHostPort(r.Host)
- if err != nil {
- log.Fatal("failed to get http host from request", zap.Error(err))
+ httpHost := r.Host
+ if strings.ContainsRune(r.Host, ':') {
+ httpHost, _, err = net.SplitHostPort(r.Host)
+ if err != nil {
+ log.Fatal("failed to get http host from request", zap.Error(err))
+ }
}
-
- url := fmt.Sprintf("https://%s:%s%s", httpHost, httpsPort, r.RequestURI)
+ b := bytes.Buffer{}
+ b.WriteString("https://")
+ b.WriteString(httpHost)
+ if httpsPort != "443" {
+ b.WriteByte(':')
+ b.WriteString(httpsPort)
+ }
+ b.WriteString(r.RequestURI)
+ url := b.String()
+ logger.Info("redirect", zap.String("origin", r.Host), zap.String("origin-path", r.URL.String()), zap.String("url", url))
http.Redirect(w, r, url, http.StatusMovedPermanently)
}),
}
See this commit: markbates/refresh@25435da
I got an error building the cmd/
folder
~/p/g/s/g/v/a/cmd ❯❯❯ go install ./
# github.com/volatiletech/abcweb/cmd
./dev.go:200: unknown field 'CommandEnv' in struct literal of type refresh.Configuration
It seems that the target folder for 'abcweb new ' needs to already exist and be an initialised git repo?
A note in the docs to this effect may be helpful.
a.Root.Execute()
call fails when config file is not present, but the error is obfuscated by a logger being nil error. Check if logger is nil as solution?
As far as I can tell its not using HTTP2 (in dev, at least)?
i used "HTTP/2 and SPDY indicator" for chrome and tried hitting myapp:4000
. Indicates it's not using http2. sites like facebook.com or google.com indicate positively.
It's a value for lookup. I propose CtxLogLookup
.
It's not clear in the documentation that if you fork a project that was generated by abcweb and you've never generated an abcweb project before (run the abcweb new
command which runs npm install
) that you will need to manually run npm install
in the root of the generated app to install the deps defined in package.json
This should probably be run every time abcweb deps is run, since that is usually the first point of call to get your deps up to date on a fresh system. It should check if the package.json file exists before running it.
url should be using localhost:35729 not whatever port you're running the go server on -- livereload port is always the same, and gulp starts a server/websocket that listens for the livereload connection, not a Go route.
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.