Comments (5)
Maybe you can follow below:
buf := new(bytes.Buffer)
_, err := buf.ReadFrom(w)
if err != nil {
return nil, err
}
b := buf.Bytes()
ctx.Response().Data(http.StatusOK, "text/html; charset=utf-8", buf)
from goravel.
Hi, we advocate front-end separation, there is no plan to support rendering pages for the time being. If you just want to return a simple HTML code, you can use like below:
ctx.Response().Data(http.StatusOK, "text/html; charset=utf-8", []byte("<b>Goravel</b>"))
from goravel.
Thanks for reply and sorry for the delay
Please how could I use html file parsing, something like this :
t, _ := template.ParseFiles("views/layout.html", "views/home/index.html")
err := t.Execute(w, nil)
Thanks
from goravel.
Thanks :)
from goravel.
Thanks for reply and sorry for the delay Please how could I use html file parsing, something like this :
t, _ := template.ParseFiles("views/layout.html", "views/home/index.html") err := t.Execute(w, nil)
Thanks
now you can do like this:
type Content map[string]interface{}
func (r *TestController) Test(ctx http.Context) {
t, _ := template.ParseFiles("views/test.html")
content := Content{"name": "test"}
_ = t.Execute(ctx.Response().Writer(), content)
}
from goravel.
Related Issues (20)
- β¨ [Feature] enhance the ability of the command feature HOT 1
- π [Bug] data error when calling facades.Auth().Parse() multiple times with different guard HOT 1
- β¨ [Feature] The queue log needs to be controled by APP_DEBUG HOT 1
- π [Bug] The context that set by facades.Orm().WithContext() isn't passed to orm events HOT 1
- β¨ [Feature] Supports configuring the json serialization/deserialization package in config/app.go HOT 2
- π [Bug] Minio does not implement filesystem.Driver HOT 2
- β¨ [Feature] Use contributors api to automatically generate contributors images in README HOT 4
- π [Bug] The new line print of Log is incorrect HOT 1
- β¨ [Feature] The trace of log can be clicked as a link HOT 1
- β¨ [Feature] Add a -f flag for make commands, to avoid cover the existing file by mistake HOT 1
- β¨ [Feature] Map the Installer to the Docs HOT 2
- β¨ [Feature] DB supports configure SSL HOT 1
- π [Bug] The traces don't cleaned when calling Log.Info after Log.Error HOT 1
- π [Bug] 樑εδΊδ»Άθ·εIDε樑εδΊδ»Άθ§¦εbug HOT 7
- π [Bug] Nil pointer dereference on validation HOT 4
- β¨ [Feature] Orm implements convenient expansion of other drivers HOT 1
- β¨ [Feature] Optimize the backslash when using facades.Route().Prefix("/product") HOT 1
- β¨ [Feature] - Any support for sqlx HOT 1
- β¨ [Feature] Remove gookit/color, use pterm/pterm instead HOT 1
- β¨ [Feature] Add ToSql, ToRawSql methods for orm HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goravel.