Skip to content

Conversation

Rubberbandits
Copy link
Contributor

This allows the capture of request path segments and their usage in request handlers.

Example:

local server = httpserver.Create()
server:Get("/user/:id", function(req, res)
    local userId = req:GetPathParam("id")
    if not userId then
        res:SetStatusCode(404)
        res:SetContent("No user specified")
        return
    end

    res:SetContent("UserID: "..userId)
end)

server:Start("0.0.0.0", 8080)

This allows the capture of request path segments and their usage in request handlers.

Example:

```lua
local server = httpserver.Create()
server:Get("/user/:id", function(req, res)
    local userId = req:GetPathParam("id")
    if not userId then
        res:SetStatusCode(404)
        res:SetContent("No user specified")
        return
    end

    res:SetContent("UserID: "..userId)
end)

server:Start("0.0.0.0", 8080)
```
@RaphaelIT7 RaphaelIT7 merged commit 5820e5d into RaphaelIT7:main Jul 24, 2025
56 checks passed
@RaphaelIT7
Copy link
Owner

Thanks <3
Though, when you make these PRs, you can also update the readme to include your changes.
Like I had done in here previously as an example: db465fb

RaphaelIT7 added a commit that referenced this pull request Jul 24, 2025
RaphaelIT7 added a commit that referenced this pull request Jul 24, 2025
@Rubberbandits
Copy link
Contributor Author

Thanks <3 Though, when you make these PRs, you can also update the readme to include your changes. Like I had done in here previously as an example: db465fb

Will do!

@RaphaelIT7 RaphaelIT7 added the enhancement New feature or request label Jul 25, 2025
@RaphaelIT7 RaphaelIT7 added this to the Release 0.8 milestone Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants