til

Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as a developer

View project on GitHub

Setting up a new Mojolicious app

Do you want to get of to a good start on your new Mojolicious application, follow these steps:

  1. Install carton
  2. Create a cpanfile
requires 'Mojolicious';
  1. Run carton
  2. Setup your application as either app (application) or lite_app (single file application)
# Mojolicious app, defaults to my_app, specify name accordingly
$ carton exec mojo generate app

# Move local/ cpanfile and cpanfile.snapshot into your application folder, please note the below example is the default name
$ mv local/ cpanfile cpanfile.snapshot my_app/
# Mojolicious lite-app, defaults to myapp.pl, specify name accordingly
$ carton exec mojo generate lite_app

And you should be good to go:

# Mojolicious app
$ cd my_app
$ carton exec morbo script/my_app

# Mojolicious lite-app
$ carton exec morbo my_app

Open your browser at:

http://localhost:3000

Start coding and remember to add your requirements to the cpanfile - have fun!