Thin Server the Hard Way (Getting Set Up)
After the diversion I just had with Java 8, time to get back to describing some features of the Modern Web.
There are any number of MV* client side frameworks out there. I’ve already mentioned TodoMVC, where you can find an extensive list, as well as sample code for each.
But before you evaluate tools, it always pays to know what pain points you’re trying to solve. So, with that in mind, I decided my first task would be to do a Thin Server application the hard way, using only jQuery to manipulate the DOM and handle the data.
Now, I didn’t want to not learn anything new during this exercise, so to keep in interesting, I added in one new dependency, Bootstrap.
So, here’s the recipe list I started with to develop the application:
Tools in Use
- Brackets, which I wanted to evaluate as an IDE
- QEDServer, which provides default REST endpoints, as well as a public directory to serve files
- jQuery, because why on earth would you use the built in DOM APIs if you didn’t have to?
- Bootstrap, to make the site look pretty
So, not quite starting at the bare metal, but close enough.
I’m not going to go over jQuery at all in describing my solution. Even though it was the first time I used it for writing anything more than a few lines, I think it’s pretty likely that anyone reading this will almost certainly know it. And if you don’t… There are any number of books out there on it, but before you invest in a book, just check out the API Documentation. It’s a small API, and quite restrained in what it’s trying to accomplish. Essentially, it’s for DOM manipulation, AJAX requests, and handful of utility functions to make those two functions easier. If you already know much about the browser DOM, it’ll take you a weekend to get up to speed. If you don’t know the browser DOM… then that’s the problem you need to solve, not learning jQuery.
I picked Bootstrap simply because it’s the most popular one right now, and they handle a bunch of things out of the box that I thought would be quite tricky for me to do on my own.
Also, because it’s the most popular framework, I was able to find lots of information on the web about various setup questions, including the fix for the bug I found.
Bootstrap’s only requirement was that jQuery be included in the same page, so that also worked out pretty well for me.
I’d certainly recommend both libraries as something that a beginner should start out with – they’re both self contained and easy to learn.
Next up, I’ll out line the architecture that I used to create my first Thin Server application