res.writeHead(302, {Location = root..req.uri.pathname})
res.end()
Will this work?
On Tuesday, 2 February 2016 04:50:52 UTC+8, Paul Reilly wrote:
>
> Hi
>
> I am beginning to play with Luvit and have one stumbling block left to
> finish an app, which is to redirect after receiving POST data. I am
> receiving the data fine, but don't know how to redirect it? Could somebody
> give me a nudge in the right direction?
>
> In http.createServer I have...
>
> if req.method=="POST" then
> local b={}
> print("request is POST")
> req:on("data", function(chunk)
> if #chunk>100 then
> return
> else
> table.insert(b,chunk)
> end
> end)
>
> req:on("end", function ()
> if #b>0 then
> req.uri.pathname=processPOST(b,req.uri.pathname)
> --res.send({redirect=root..req.uri.pathname})
> --req.redirect(req.uri.pathname)
> --req:redirect(req.uri.pathname)
> end
> end)
>
> Thanks for any advice,
>
> Cheers
>
> Paul
>
--
You received this message because you are subscribed to the Google Groups
"luvit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.