November 2018
Intermediate to advanced
404 pages
10h 16m
English
The handler for getting a record of an existing journal entry makes use of parameters to get the id for the entry and retrieve the JournalEntry object automatically using the next(JournalEntry.self) method call:
func getEntry(_ req: Request) throws -> Future<JournalEntry> { return try req.parameters.next(JournalEntry.self)}
You can try to retrieve a journal entry with curl and provide an ID for the item:
$ curl http://localhost:8080/api/admin/1
With the /api/admin/<id> endpoint, curl will ask your handler to retrieve the specified item and print out the journal entry wrapped in a JSON object if the item is found.
Read now
Unlock full access