Getting no handler accepted
Closed this issue · 2 comments
Hi
I'm a haskell beginner and I'm getting the error not found "No handler accepted "/users" when trying to access the url localhost:8081/users. The root, only localhost:8081/ shows some graphs but the /users endpoint gives me not found.
The UserAPI:
type UserAPI = "users" :> Get '[JSON] [Entity User] :<|> "users" :> Capture "name" Text :> Get '[JSON] (Entity User) :<|> "users" :> ReqBody '[JSON] User :> Post '[JSON] Int64 :<|> "metrics" :> Get '[JSON] (HashMap Text Int64)
The server:
userServer :: MonadIO m => ServerT UserAPI (AppT m)
userServer = allUsers :<|> singleUser :<|> createUser :<|> waiMetrics
allUsers :: MonadIO m => AppT m [Entity User]
allUsers = do
increment "allUsers"
logDebugNS "web" "allUsers"
runDb (selectList [] [])`
You have to set the content-type to application/json
. If you open with your browser, it will ask for HTML or plaintext. Try opening with your browser just localhost:8081/
and using the primitive UI there?
I forgot to close the issue. Thanks for the help and sorry for the late reply.