Lurker News

Comments (378) 171 threads

Show all comments

Showing thread 3 of 171

Minor49er2 replies#
This is a cool site, though I did notice something that I haven't seen anywhere before: the URL paths are JSON objects. Is there a reason for this? For example, for "The Call of Cthulhu", the URL is this: https://www.typelit.io/chapters/%7B%22bookTitle%22:%20%22The...

Why not just use this? https://www.typelit.io/chapters/5f468ca35e91c10be0883a57/The...
Also, the JSON object is fault tolerant and will display whatever you want for a title, even if there isn't a book available: https://www.typelit.io/chapters/%7B%22%64%69%73%70%6C%61%79%...

whiddershins2 replies#
This comment can’t be read, perhaps use code block formatting, or remove the http and domain info, so we can see what you mean? The link is getting truncated when it displays.
SamBam#
Those links are over 200 characters long, and just look like escaped JSON, so I don't think it would help much. You could just click on them if you really wanted to know the details, but I think the question is pretty clear regardless.
Minor49er#
That's a fair point. I was expecting people to click or hover the links to see the examples, but for really showing how the paths are formed, this would make sense to do.
Octouroboros4 replies#
Hey I'm glad you asked! It's the way Nextjs handles urls with more than 1 param. If I prettify the URL then for some reason the page can't access them. Don't know if they've improved on it yet (or, who knows, maybe I'm just using it wrong) but it'll be fixed eventually.
SamBam#
The URL parameters are:

{"bookTitle": "The Call of Cthulhu", "displayTitle": "The Call of Cthulhu", "language": "English", "bookId": "5f468ca35e91c10be0883a57"}
Why do you need all the others besides "bookId"?
Changing "bookTitle" and "language" don't seem to do anything. Changing "displayTitle" does change the displayed title, but why can't you get that using the bookId?

Minor49er1 reply#
That's interesting. Thanks for pointing me towards Next.js. I wasn't aware of that framework, but I'm checking it out.
technoplato2 replies#
Super cool framework that is only getting better. If you’re interested in framework spelunking-check out Remix by Ryan Florence and Michael Jackson (no, not that one...). It’s actually going to be paid but I’m very excited to try it. It handles some data loading pain points among others that seem very interesting.

Continue this thread — 2 replies

john_miller#
// call /MyPage?par1=hello&par2=42

const MyPage = (props: { query: { par1: string; par2: number } }) => ( {`${props.query.par1}-${props.query.par2}`} );

ffpip#
I think only the bookID is necessary