I recommend using Air for live reloading.
git clone https://github.com/refiber/example-crud.git
cd example-crud
npm i && npm run build
air
If you're new to the Refiber framework, simply open the route file at
/routes/web.go
, then follow the pattern from the route to the controller and finally to the view.
Refiber is a web framework based on the Gofiber framework, follows the MVC architecture (Model, View & Controller).
Refiber comes with Inertia.js built-in. Inertia.js is a powerful tool for creating Single Page Applications (SPA) without needing a separate API.
// in your Controller
func (web *webController) Index(s support.Refiber) error {
return web.inertia.Render().Page("Home", &fiber.Map{
"hello": "World",
})
}
// in your React App
export default function HomePage({ hello }) {
return <h1>Hello {hello}</h1>;
}
Online documentation https://refiber.notion.site
To install Refiber, you first need to install the CLI. Use the following command:
go install github.com/refiber/refiber-cli@latest
Now you can just run this command bellow to create a new Refiber project
refiber-cli new my-app