• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jeffotoni / quick / 214

04 Mar 2025 07:11AM UTC coverage: 49.209% (-26.0%) from 75.221%
214

push

circleci

jeffotoni
Merge branch 'feature/refactory_http_client'

new version http client

32 of 1275 new or added lines in 44 files covered. (2.51%)

15 existing lines in 1 file now uncovered.

1803 of 3664 relevant lines covered (49.21%)

2724.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/example/quick.delete/delete.go
1
package main
2

3
import (
4
        "log"
5
        "net/http"
6

7
        "github.com/jeffotoni/quick"
8
)
9

10
// User struct defines a user with Name and Year of birth
11
type User struct {
12
        Name string `json:"name"` // User's name
13
        Year int    `json:"year"` // User's birth year
14
}
15

NEW
16
func main() {
×
NEW
17
        q := quick.New()
×
NEW
18

×
NEW
19
        // Simulating a "database" with pre-registered users
×
NEW
20
        users := map[string]User{
×
NEW
21
                "1": {Name: "Maria", Year: 2000}, // Fixed user with ID 1
×
NEW
22
        }
×
NEW
23

×
NEW
24
        // DELETE route to remove a user by ID
×
NEW
25
        q.Delete("/v1/user/:id", func(c *quick.Ctx) error {
×
NEW
26
                userID := c.Params["id"] // Retrieve user ID from URL parameter
×
NEW
27

×
NEW
28
                // Check if the user exists in the "database"
×
NEW
29
                if _, exists := users[userID]; !exists {
×
NEW
30
                        return c.Status(http.StatusNotFound).JSON(map[string]string{"error": "User not found"})
×
NEW
31
                }
×
32

33
                // Delete the user from the "database"
NEW
34
                delete(users, userID)
×
NEW
35

×
NEW
36
                // Return a success response
×
NEW
37
                return c.Status(http.StatusOK).JSON(map[string]string{"msg": "User deleted successfully!"})
×
38
        })
39

40
        // Start the server on port 8080
NEW
41
        log.Fatal(q.Listen("0.0.0.0:8080"))
×
42
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc