Rewrite in a nicer way
This commit is contained in:
parent
5feee7a11f
commit
e11e2de64c
@ -42,9 +42,10 @@ app runner = do
|
|||||||
Nothing -> respond notFound
|
Nothing -> respond notFound
|
||||||
|
|
||||||
post "/short" $ do
|
post "/short" $ do
|
||||||
(form, _) <- parseForm
|
form <- fmap fst parseForm
|
||||||
case BS.unpack <$> lookup "url" form of
|
case lookup "url" form of
|
||||||
Just url -> do
|
Just url' -> do
|
||||||
|
let url = BS.unpack url'
|
||||||
name <- liftIO (insert table url)
|
name <- liftIO (insert table url)
|
||||||
logStr (printf "Registered %s -> %s " url name)
|
logStr (printf "Registered %s -> %s " url name)
|
||||||
render done $ object ["link" .= (bindUrl ++ name)]
|
render done $ object ["link" .= (bindUrl ++ name)]
|
||||||
|
Loading…
Reference in New Issue
Block a user