Getting Started
To create a new Goffee project you need to install the command goffee
first. It is the cli tool
.
Installing the CLI tool [goffee]
To install the goffee
globally open up your terminal and run the following command:
go install git.smarteching.com/goffee/goffee@latest
Detailed istructions in installation
Create a new project:
To create a new project run the following command
goffee new myapp git.smarteching.com/goffee/myapp
Where:
myapp
is the name of your project.
git.smarteching.com/goffee/myapp
is the remote repository that will host the project
Add a route
Let's create a route that returns hello world
Open up the file routes.go
in the root of your project and add to it the code below:
controller.Get("/greeting", func(c *core.Context) *core.Response {
JsonString := `{"message": "hello world"}`
return c.Response.Json(JsonString)
})
Next, in your terminal navigate to the project dir and run the following command to start the live reloading
:
goffee run:dev
Finally, open up your browser and navigate to http://localhost:8080/greeting
To learn more check the routing docs section