From the course: Building RESTful Web Services with DropWizard

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Finalize endpoints code

Finalize endpoints code

- [Narrator] In this example application, we also have an endpoint date, where we could return a date. So let's go ahead and write the code to have an endpoint return a date. So let's go ahead and do that. So what we're going to do just below the post endpoint here, we're going to do the get, and then we also need to add into our constructor, a path, which will call /date. And then producers. So producers, and then pass the media type of text. So mediatype.textplain, like so. And then we're going to do the function that will return the date, so let's go ahead and do that. So this is the actual function, once we call this particular endpoint the receive date And again, like we've done here, we're going to pass query params, so let's go and copy that, and we'll change a few things. So let's go ahead and copy that and paste it here, so the query param is going to be of name date, and it's going to be an…

Contents