0
votes

I have akka http app running using the code here and one of my routes is having segments in it.

When I tested the rest path with segment, I get the below error.

Request

curl -i -X POST \ -H "Content-Type:application/json" \ -d \ '{"tickets":2}' \ 'http://localhost:5000/events/RHCP/tickets'

Response

HTTP/1.1 404 Not Found

Content-Length: 83

Content-Type: text/plain; charset=UTF-8

Date: Tue, 02 Jan 2018 11:59:38 GMT

Server: GoTicks.com REST API

The requested resource could not be found but may be available again in the future.

Is there any configuration missing or it is bug?

1
It's your code that is returning 404 here github.com/rajcspsg/akka_in_action/blob/master/chapter1/src/…. This is expected.Stefano Bonetti

1 Answers

0
votes

I think pathPrefix is matching eventsRoute and finds no POST directive

try this:

change

def routes: Route = eventRoute ~ eventsRoute ~ ticketsRoute

to

def routes: Route = ticketsRoute ~ eventsRoute ~ eventRoute