mirror of
https://github.com/Dokploy/examples
synced 2025-06-26 18:15:52 +00:00
31 lines
370 B
Go
31 lines
370 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
func getPort() string {
|
|
port := os.Getenv("PORT")
|
|
if port == "" {
|
|
port = ":3000"
|
|
} else {
|
|
port = ":" + port
|
|
}
|
|
|
|
return port
|
|
}
|
|
|
|
func main() {
|
|
app := fiber.New()
|
|
|
|
app.Get("/", func(c *fiber.Ctx) error {
|
|
return c.JSON(fiber.Map{
|
|
"message": "Hello, Railway!",
|
|
})
|
|
})
|
|
|
|
app.Listen(getPort())
|
|
}
|