Build It With Nitrogen Book Club

Chapter 1 - Frying Pan to Fire

I really like the way the book is written. It’s like a story. It’s very different from all the other books of the same category.

Installing Nitrogen is not like installing rails nor phoenix, you need to clone the nitrogen repo under nitrogen/nitrogen.

After that, by cd into the nitrogen folder, it will generate a fresh new app with make.

make rel_inets PROJECT=devtalk

By inspecting the Makefile I can see that you’re not forced to use one specific web server like Erlang’s basic one.
You can choose between – all with different versions like slim:

  • Cowboy
  • Inets
  • Mochiweb
  • Webmachine
  • Yaws

To be honest I only knew the existence of Cowboy and Inets. Probably gonna check the others.

By cd into devtalk and running bin/nitrogen console the server starts running on 8080.

The code which interests me is under the site folder.

By crack opening the templates/bare.html as suggested by the book, I can see this:

It seems to be the Nitrogen’s “secret sauce”. Like sharding for MongoDB web-scale…

I really like the little notes like this one:

Most of the Erlang community prefers Emacs,
but the authors are oddballs and prefer Vim.

I agree a 100 percent :laughing:

It’s important to note that since Nitrogen 3, it uses Rebar3.
Also that ViM and Emacs got an extension to handle a special indentation for Nitrogen.

It goes from this:

Elements = #panel { body=[
                         #span { text="Hello, World"}
                         ]},

to this:

Elements = #panel {body=[
    #span{text="Hello, World!"}
]},

Which is in fact probably quite helpful in a big file.
The syntax reminds me of Elm, and its special way to define HTML in this style.

This first chapter is a little ice breaker, nothing too technical, but it lays the foundation of the book. I kinda like it.

4 Likes