Fork me on GitHub
#pedestal
<
2021-08-07
>
v3ga21:08:48

Noob question, I’m trying to figure out how handle routing/saving to a db. I’m basically trying to use ‘store-book!’ in db.clj in the interceptor ‘insert-book’ but I’m getting a 404. How bad am I butchering this? https://gist.github.com/v3gal0g/a2656ddad262a04641f1c6e4d8833534

vemv22:08:27

have you tried a simpler endpoint first? GET instead of POST what's your repro? you haven't specified a curl command or such have you tried increasing the logging level? have you successfully used the official pedestal template for some quick inspiration?

vemv22:08:52

(you don't need to answer these one by one - simply trying to hint how I'd solve this myself :) )

v3ga22:08:34

lol, yeah i’ve gone through the basic docs and made basic APIs. i’ll be toying with logging next. I’m fairly new to clojure and dev in general but I feel i’m fairly close. I’ve been attempting to work with POSTMAN and getting a 404 error. One thing I’m doing a bit differently from the examples I’ve seen is people handle the DB transactions within the interceptor. I’ve sort of decoupled that. Still going over things to figure what alls necessary.

vemv22:08:32

perhaps it's related to code loading/reloading. for that reason I'd try to toy with a GET endpoint, make a small change to it and verify that code reloading effectively changes its behavior otherwise make small changes (change GET to a minimalistic POST endpoint. then add functionality to the POST) until you detect the precise source of the issue

v3ga23:08:51

Oh… I may not be far off. Going to test a few things. But now that i’m using restclient in emacs It’s hitting something.

v3ga23:08:16

Got it! it was working correctly.

🍻 2