The MVC architecture, today’s standard for at least web development, if abused, often turns into a nightmare of objects sharing a lot of responsibilities, and spanning across different areas, knowing about different objects, essentially defeating the holy grail purpose of separation of concerns.
We shouldn’t be polluting MVC, we should be embracing it. There’s a reason that monolithic have become a problem, and while I certainly favor micro-services and SOA for complex applications, I’m aware that usually the problem with them it’s not having everything under the same directory structure, it’s not the team, and it’s not isolating components, it’s usually the code inside that app that has become a burden to maintain and refactor.
JWT (short for JSON Web Token) is a compact URL-safe means of representing claims to be transferred between two parties, as defined by the standard. It’s usually used for authentication and recently is being favored over the classic cookie scheme in Single Page Applications (SPAs).
Although cookies and server-side authentication are the most established solutions, for APIs usually better alternatives are OAuth2 and JWT.
This post assumes some level of familiarity, but should be easy to follow, visiting the homepage that I linked before should suffice for most of the code samples, if you want me to do a resources recommendation to dig deeper you can check Intridea’s blog post, another one by Toptal (it’s focused on Laravel, but the introductory section it’s worth reading), or if you want to go all the way you check this PluralSight course on OAuth2, OpenID Connect and JWT.
Always wanted to bend the Markdown markup language to do things it wasn’t designed to do. I love the language’s simplicity, and that’s precisely what gets in your way if you’re thinking about What if it were just a little more dynamic?.
Basically, what we’ll do it’s to tweak the parser/renderer a little to allow this dynamic processing of our input, and to get in the middle of the rendering process to achieve our results.