Added error handling

This commit is contained in:
2024-06-19 03:19:08 +02:00
parent cfad6759a5
commit 5dc82d3b5b
6 changed files with 43 additions and 6 deletions
+8
View File
@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/url-shortener.iml" filepath="$PROJECT_DIR$/.idea/url-shortener.iml" />
</modules>
</component>
</project>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
+2 -1
View File
@@ -2,9 +2,10 @@ module github.com/andwati/url-shortener
go 1.22.4
require github.com/gofiber/fiber/v2 v2.52.4
require (
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/gofiber/fiber/v2 v2.52.4
github.com/google/uuid v1.5.0 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
+10 -5
View File
@@ -2,16 +2,21 @@ package main
import "github.com/gofiber/fiber/v2"
func main(){
func main() {
app := fiber.New()
app.Get("/", hello)
app.Listen(":3000")
err := app.Listen(":3000")
if err != nil {
return
}
}
func hello(c *fiber.Ctx) error {
c.SendString("Hello, World!")
err := c.SendString("Hello, World!")
if err != nil {
return err
}
return nil
}
}