A high productivity, full-stack web framework for the Go language.
revel new -a
[revel/heroku-buildpack-go-revel]
packages.Load
scan which will fast fail on compile error, and leave you with go files with no syntax.[revel/heroku-buildpack-go-revel]
map[string]interface{}
which means you can place any object that can be serialized to a string.revel.controller.reuse
app.conf option to turn on / off reuse of the controllers. Defaults to truecontroller.Session is now a map[string]interface{} (previously was map[string]string) this means existing code needs to cast any values they pull from the session
if username, ok := c.Session["user"]; ok { // username is a string type
return c.getUser(username)
}
changes to
if username, ok := c.Session["user"]; ok { // username is an interface{} type
return c.getUser(username.(string))
}
Deprecated log points removed revel.ERROR, revel.TRACE, revel.DEBUG, revel.WARN have been removed
Function name change revel.OnAppStop
Replaced revel.OnAppShutdown
revel.SimpleStack was moved to github.com/revel/revel/utils.SimpleStack
See manual for more information on the flags and new features
revel
tool will still be able to create a new projectrevel run
to pass in json code to the revel.Init
function in place of the mode
field. This allows for dynamic information to be passed to the Revel Server. This can be disabled by using this flag --historic-run-mode
revel new
added -V
to auto create the vendor folder inside the application along with the Gopkg.toml file.revel new
added -r
to run the application after creating it.go test
from the command line. Meaning your tests can now live beside the controller. An example testsuite is here
revel.RaiseEvent()
Request.Context() map[string]interface()
renamed to
Request.Args() map[string]interface()
new function added which returns the request.Context for the server-engine that supports it
Request.Context() context.Context
revel.EventHandler
signature was func(typeOf int, value interface{}) (responseOf int)
now it is func(typeOf Event, value interface{}) (responseOf EventResponse)Fix import to point to the fsnotify/fsnotify.v1
This release is focused on improving the security and resolving some issues.
There are no breaking changes from version 0.18
AppVersion
regardless of where Revel is run revel/cmd#108deps
(to checkout go libraries) if a vendor folder exists in the project root.http.Request
is no longer contained in revel.Request
revel.Request remains functionally the same but
you cannot extract the http.Request
from it. You can get the http.Request
from revel.Controller.Request.In.GetRaw().(*http.Request)
http.Response.Out
Is not the http.Response and is deprecated, you can get the output writer by doing http.Response.GetWriter()
. You can get the http.ResponseWriter
from revel.Controller.Response.Out.Server.GetRaw().(*http.ResponseWriter)`
Websocket
changes. revel.ServerWebsocket
is the new type of object you need to declare for controllers
which should need to attach to websockets. Implementation of these objects have been simplified
Old
func (c WebSocket) RoomSocket(user string, ws *websocket.Conn) revel.Result {
// Join the room.
subscription := chatroom.Subscribe()
defer subscription.Cancel()
chatroom.Join(user)
defer chatroom.Leave(user)
// Send down the archive.
for _, event := range subscription.Archive {
if websocket.JSON.Send(ws, &event) != nil {
// They disconnected
return nil
}
}
// In order to select between websocket messages and subscription events, we
// need to stuff websocket events into a channel.
newMessages := make(chan string)
go func() {
var msg string
for {
err := websocket.Message.Receive(ws, &msg)
if err != nil {
close(newMessages)
return
}
newMessages <- msg
}
}()
New
func (c WebSocket) RoomSocket(user string, ws revel.ServerWebSocket) revel.Result {
// Join the room.
subscription := chatroom.Subscribe()
defer subscription.Cancel()
chatroom.Join(user)
defer chatroom.Leave(user)
// Send down the archive.
for _, event := range subscription.Archive {
if ws.MessageSendJSON(&event) != nil {
// They disconnected
return nil
}
}
// In order to select between websocket messages and subscription events, we
// need to stuff websocket events into a channel.
newMessages := make(chan string)
go func() {
var msg string
for {
err := ws.MessageReceiveJSON(&msg)
if err != nil {
close(newMessages)
return
}
newMessages <- msg
}
}()
revel.Request.FormValue()
Is deprecated, you should use methods in the controller.Params to access this datarevel.Request.PostFormValue()
Is deprecated, you should use methods in the controller.Params.Form to access this datarevel.Request.ParseForm()
Is deprecated - not neededrevel.Request.ParseMultipartForm()
Is deprecated - not neededrevel.Request.Form
Is deprecated, you should use the controller.Params.Form to access this datarevel.Request.MultipartForm
Is deprecated, you should use the controller.Params.Form to access this datarevel.TRACE
, revel.INFO
revel.WARN
revel.ERROR
are deprecated. Use new application logger revel.AppLog
and the controller logger controller.Log
. See logging for more details.Critical issue identified details here #1200
CurrentLocaleRenderArg
to CurrentLocaleViewArg
for consistencytext/json
or application/json
. The raw data is available in Revel.Controller.Params.JSON
. But you can also use the automatic controller operation to load the data like you would any structure or map. See here for more details