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