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

jeffotoni / quick / 318

16 Apr 2025 04:46PM UTC coverage: 52.014% (-0.02%) from 52.03%
318

push

circleci

jeffotoni
docs: improve Contributing

3525 of 6777 relevant lines covered (52.01%)

1479.71 hits per line

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

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

3
import "github.com/jeffotoni/quick"
4

5
// Struct representing a user model
6
type My struct {
7
        Name string `json:"name"` // User's name
8
        Year int    `json:"year"` // User's birth year
9
}
10

11
func main() {
×
12
        q := quick.New() // Initialize Quick framework
×
13

×
14
        // Define a POST route at /v1/user
×
15
        q.Post("/v1/user", func(c *quick.Ctx) error {
×
16
                var my My // Create a variable to store incoming user data
×
17

×
18
                // Parse the request body into the struct
×
19
                err := c.BodyParser(&my)
×
20
                if err != nil {
×
21
                        // If parsing fails, return a 400 Bad Request response
×
22
                        return c.Status(400).SendString(err.Error())
×
23
                }
×
24

25
                // Return the parsed JSON data as a response with 200 OK
26
                return c.Status(200).JSON(quick.M{
×
27
                        "name": "jeff",
×
28
                })
×
29

30
                // Alternative:
31
                // return c.Status(200).String(c.BodyString())
32
                // Return raw request body as a string
33
        })
34

35
        // Start the server and listen on port 8080
36
        q.Listen("0.0.0.0:8080")
×
37
}
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