Creating a cloudflare pages website using GO

I am trying to create a website and deploy it using cloudflare pages using GO. I've managed getting into the build phase and it correctly builds the application and I assume that the binary gets to the specified path. After this the website is not accessible, it seems as if it does not know how to run the binary. How can I achieve this? My build command in pages is: go build cmd/main.go build My build output directory is: build My GO code of the website is the following:
package main

import "github.com/gofiber/fiber/v2"

func main() {
app := fiber.New()

app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("Hello, World!")
})

app.Listen(":8080")
}
package main

import "github.com/gofiber/fiber/v2"

func main() {
app := fiber.New()

app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("Hello, World!")
})

app.Listen(":8080")
}
2 Replies
Hello, I’m Allie!
?pages-webserver
Flare
Flare6mo ago
Cloudflare Pages is for static content (HTML, CSS, JS, images and other such files). It will not run a webserver such as Express, Koa or the likes. If you're using those to serve static content then you can just remove that part and use Pages! If you're doing more dynamic content you can use Functions (https://developers.cloudflare.com/pages/platform/functions). It will run code on request (so still not a webserver in the conventional sense). This would allow for more dynamic content though especially with KV (Key Value storage) and Durable Objects (transactional data storage). Functions are natively integrated with Pages so are super easy to get up and running along your website. Otherwise, a good old VPS or dedicated server from one of the many hosts out there is for you.
Want results from more Discord servers?
Add your server