What needs to be considered for an API-only project when upgrading from 2.0 to 2.1?

Hey :wave:,

Thanks for all the work that went into Hanami 2.1.

I have an API-only Hanami project (2.0.3) using persistence similar to GitHub - decafsucks/decafsucks: Rebuilding decafsucks.com as an OSS Hanami 2.0 example app and I wanted to make sure if there is anything special to consider while upgrading to 2.1?

There’s a upgrade-guide V2.1: v2.1.0 | Hanami Guides, but but there are still questions:

With an API-only project, I can simply omit the view gems, right?
Do I need the hanami webconsole? I haven’t used it so far. It’s a middleware to show errors, right? And this middleware is only used in development mode?

I haven’t quite understood the difference between hanami dev and hanami server yet. Can someone briefly explain this?

Best regards

Hi @wuarmin, great question!

The hanami-view and hanami-assets gems are entirely optional, so if you don’t need them, you can keep them out of your Gemfile and ignore all the related steps in that v2.1 upgrade guide :+1:

As for hanami-webconsole, you’re right: it’s a gem that provides friendly HTML errors in development mode only. You can choose to include it if you want those, but if not, you can omit it as well.

As for the CLI commands, the hanami server command runs the Ruby web server for your hanami app. For an API app, this is all you need. hanami dev is simply a conventional way to call bin/dev script, and by default we have it so that script launches a process manager for whatever processes are defined in Profile.dev. This is helpful when running a full stack Hanami app, because in that case you need to run both the Ruby web server (aka hanami server) as well as the front end assets watcher (hanami assets watch).

I hope that answers all your questions! Please reply if there’s anything else I can do to clear things up :smile:

1 Like

Thanks @timriley for the clear answer!

I appreciate your work and am glad that Hanami has another great lead after @jodosha :grinning:.

1 Like

I’ve been running an API-only set of Hanami services on 2.1 since the Release Candidates, we don’t use the asset system and there were no problems whatsoever.

1 Like