Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@briandfoy
Last active May 19, 2020 02:25
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briandfoy/6f21a8c0228e109ef48904c26422cb2d to your computer and use it in GitHub Desktop.
Save briandfoy/6f21a8c0228e109ef48904c26422cb2d to your computer and use it in GitHub Desktop.
Mojolicious Web Applications book outline
I'm not committing to the book just yet, but I'm thinking about what the outline would be.
I'm thinking about running another Kickstarter if I can find a major sponsor like I did
last time. Email me if you might be that person.
The basic idea is a tutorial book on writing that would start from scratch and build up.
This is specifically not a reference book that covers every aspect of Mojolicious. The
trick is to figure out all the topics that should be in the book and how to introduce them
gradually. Most topics should be relevant to most of the audience, while uncommon tasks
or lightly used features might not show up at all.
The User-Agent stuff is already in Mojolicious Web Clients. (https://amzn.to/2P5hkmP or https://leanpub.com/mojo_web_clients)
And, I have an eye on a separate websockets book.
* Random stuff that needs a home
+ web security (CSRF, etc)
+ javascript thingies (React, whatever)
+ Single page applications
* Introduction
+ Installing
* Hello World
+ using mojo to create an app
+ Mojo Lite
+ testing
* Writing a simple static file server
+ docker?
+ logging
+ more testing
* Templated files
+ MVC stuff
+ more stuff about rendering
+ wrappers, headers, footers, whatever
+ more testing
* Form handling routes
+ handling get
+ handling post
+ more testing
* Mojo not lite
+ where do you make the switch
* Database things
+ Basic crud stuff
+ Mojo::Pg
+ more testing
* REST (-like) interactive interfaces
+ handling routes based on the URL
+ cookies
+ sessions
+ multiple controllers
+ different return types (json, html, etc)
* Writing a simple web service
+ get and post
+ API publishing thingys
* Writing a complex web service
+ put
+ delete
+ other such things
* Chat server (websockets?)
+ shared message queue, etc
* Plugins and the like
* Advanced Rendering tricks
* Misc Advanced topics
* Production Servers
+ deployment
+ hypnotoad
+ proxied behind apache
+ proxied behind nginx
+ cloudflare
+ aws
* Appendices
+ What we didn't cover
----
Similar books:
* Flask Web Development
* https://django-book.readthedocs.io/en/latest/
* https://www.railstutorial.org/book
* https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world
@jberger
Copy link

jberger commented Dec 6, 2019

  • Form handling: you probably want to look at the validator, at least mention that its there if not actually explain it in detail. There is also heavier things like JSON::Validator/joi/OpenAPI that can help too.
  • When to switch to full apps? I do it almost immediately, except in the cases of demos and PURE proof of concepts. Hybrid-style full apps are so easy I almost always skip right to that. Sure teach lite, but the switch comes very early for me.
  • I like the heavy focus on testing. I do that in my mojo talks too. Mojo is very test-inspired (if not purely TDD), and showing how easy it is to test a mojo app is often a major selling point (and a thing I miss in most other languages/frameworks).

@christopherraa
Copy link

  • Emphasis on full apps would be nice. We almost immediately go to full apps due to simplified structure and easier testing
  • A common question we've had with clients during trainings is how to "properly" extract code into plugins
  • When to use helpers as $c->helper_name() VS $c->app->helper_name()
  • Deploying to hosted k8s is pretty common in books / tutorials these days, but running Docker containers locally is a very good and easy way to demonstrate the concepts. Building an example application with 1) a full application 2) a PostgreSQL server and 3) a minion worker all run through docker-compose would demonstrate a lot of the things that people often need in their applications. docker-compose is also very low-threshold compared to a full k8s-deployment.
  • OpenAPI is still relevant, so it would propably be good to cover that both from the consumer and the provider side of things. Having an application exposing something OpenAPI-enables, and using the OpenAPI-client as part of the tests would perhaps be a good enough demonstration?

Other than that: love the initiative!

@preaction
Copy link

Some ideas for the advanced rendering tricks chapter:

  • include w/ custom stash arguments (or even just inheriting the stash from the parent)
  • extends is massively useful, but it took me quite a bit of playing around to figure out how useful (something a book would be perfect to shortcut)

Another possible idea that might be its own book:

  • Overriding Mojolicious's behavior with_roles: In Mojolicious, nearly every method can be a hook to custom behavior by doing $app->$THING->with_roles( 'My::Role' ). Not that the existing hooks aren't powerful enough (the around dispatch hook can do literally anything)

@alaurie
Copy link

alaurie commented Feb 6, 2020

I think a companion video course along with the book would be a great idea. This is probably biased in the fact that I personally don't find technical books deeply engaging. Usually get part way through and never finish. I think there is a market there and is easier to keep updated and tweak than a published book (unless self publishing). Examples below are well regarded video courses.

Course Examples:
https://courses.miguelgrinberg.com/p/flask-mega-tutorial
https://training.talkpython.fm/
https://realpython.com/courses/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment