Friday, May 9, 2025
News PouroverAI
Visit PourOver.AI
No Result
View All Result
  • Home
  • AI Tech
  • Business
  • Blockchain
  • Data Science & ML
  • Cloud & Programming
  • Automation
  • Front-Tech
  • Marketing
  • Home
  • AI Tech
  • Business
  • Blockchain
  • Data Science & ML
  • Cloud & Programming
  • Automation
  • Front-Tech
  • Marketing
News PouroverAI
No Result
View All Result

Let’s build a Hanami app

March 12, 2024
in Front-Tech
Reading Time: 2 mins read
0 0
A A
0
Share on FacebookShare on Twitter



Hanami is a modern full-stack Ruby web framework that offers developer freedom by not imposing too many default assumptions, unlike Rails. The framework is known for its speed, low memory footprint, and focus on minimalism. With strict abstractions, Hanami can be a viable alternative to Rails for building applications like APIs and micro-services. In this tutorial, we will explore the structure and features of Hanami by building a simple blog application. Let’s get started.

Prerequisites:
– Ruby 3.0+ installed
– Local installation of Postgresql

Installing Hanami and generating a new application:
1. Install Hanami by running the command:
2. Generate a new Hanami app with the command:
3. This will create an app directory structure similar to Rails, with directories like app, lib, and config for organizing your code and configurations.

Note: Hanami version 2.0 does not include the Hanami view integration, so you will need to add the Hanami view gem to your Gemfile and run bundle install.

The app we’ll be building:
We’ll be building a simple blog app to showcase Hanami’s internals and strengths. You can find the source code for the completed app here.

Adding persistence to a Hanami app:
Since Hanami 2.1 will include a natively integrated persistence library, we’ll use the Ruby Object Mapper (ROM) library for the persistence layer in our blog app. Follow these steps to add persistence:

1. Install the ROM library by adding the gems to your Gemfile and running bundle install.
2. Create a Postgresql database and configure the database settings in the app.
3. Add a persistence provider in the config/providers/persistence.rb file to manage database connections.
4. Define the database connection string in the app’s settings file and set up the .env file with the database URL.
5. Create and run the first migration manually using rake tasks to set up the posts table in the database.

Next, we’ll build a relation to interact with the posts table and set up a repository with CRUD methods for accessing data. The relation defines how data is read and written to the database, while the repository provides convenient methods for interacting with the posts data.

By following these steps, you’ll have a working blog application in Hanami with persistence and data access capabilities. Feel free to explore the ROM library and Hanami’s documentation for more advanced features and functionalities.



Source link

Tags: AppBuildHanamilets
Previous Post

Robotic interface masters a soft touch

Next Post

Patterson Companies announces $500 million stock repurchase By Investing.com

Related Posts

The essential principles of a good homepage
Front-Tech

The essential principles of a good homepage

June 7, 2024
How to measure and improve user retention
Front-Tech

How to measure and improve user retention

June 6, 2024
Push Animation on Grid Items
Front-Tech

Push Animation on Grid Items

June 5, 2024
How to build a Rails API with rate limiting
Front-Tech

How to build a Rails API with rate limiting

June 4, 2024
Introduction to the B.I.A.S. framework
Front-Tech

Introduction to the B.I.A.S. framework

June 3, 2024
Blue Ridge Ruby is exactly what we need
Front-Tech

Blue Ridge Ruby is exactly what we need

June 3, 2024
Next Post
Patterson Companies announces $500 million stock repurchase By Investing.com

Patterson Companies announces $500 million stock repurchase By Investing.com

How do neural networks learn? A mathematical formula explains how they detect relevant patterns

How do neural networks learn? A mathematical formula explains how they detect relevant patterns

Training Value Functions via Classification for Scalable Deep Reinforcement Learning: Study by Google DeepMind Researchers and Others

Training Value Functions via Classification for Scalable Deep Reinforcement Learning: Study by Google DeepMind Researchers and Others

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Trending
  • Comments
  • Latest
Is C.AI Down? Here Is What To Do Now

Is C.AI Down? Here Is What To Do Now

January 10, 2024
Porfo: Revolutionizing the Crypto Wallet Landscape

Porfo: Revolutionizing the Crypto Wallet Landscape

October 9, 2023
A Complete Guide to BERT with Code | by Bradney Smith | May, 2024

A Complete Guide to BERT with Code | by Bradney Smith | May, 2024

May 19, 2024
Part 1: ABAP RESTful Application Programming Model (RAP) – Introduction

Part 1: ABAP RESTful Application Programming Model (RAP) – Introduction

November 20, 2023
Saginaw HMI Enclosures and Suspension Arm Systems from AutomationDirect – Library.Automationdirect.com

Saginaw HMI Enclosures and Suspension Arm Systems from AutomationDirect – Library.Automationdirect.com

December 6, 2023
A faster, better way to prevent an AI chatbot from giving toxic responses | MIT News

A faster, better way to prevent an AI chatbot from giving toxic responses | MIT News

April 10, 2024
Can You Guess What Percentage Of Their Wealth The Rich Keep In Cash?

Can You Guess What Percentage Of Their Wealth The Rich Keep In Cash?

June 10, 2024
AI Compared: Which Assistant Is the Best?

AI Compared: Which Assistant Is the Best?

June 10, 2024
How insurance companies can use synthetic data to fight bias

How insurance companies can use synthetic data to fight bias

June 10, 2024
5 SLA metrics you should be monitoring

5 SLA metrics you should be monitoring

June 10, 2024
From Low-Level to High-Level Tasks: Scaling Fine-Tuning with the ANDROIDCONTROL Dataset

From Low-Level to High-Level Tasks: Scaling Fine-Tuning with the ANDROIDCONTROL Dataset

June 10, 2024
UGRO Capital: Targeting to hit milestone of Rs 20,000 cr loan book in 8-10 quarters: Shachindra Nath

UGRO Capital: Targeting to hit milestone of Rs 20,000 cr loan book in 8-10 quarters: Shachindra Nath

June 10, 2024
Facebook Twitter LinkedIn Pinterest RSS
News PouroverAI

The latest news and updates about the AI Technology and Latest Tech Updates around the world... PouroverAI keeps you in the loop.

CATEGORIES

  • AI Technology
  • Automation
  • Blockchain
  • Business
  • Cloud & Programming
  • Data Science & ML
  • Digital Marketing
  • Front-Tech
  • Uncategorized

SITEMAP

  • Disclaimer
  • Privacy Policy
  • DMCA
  • Cookie Privacy Policy
  • Terms and Conditions
  • Contact us

Copyright © 2023 PouroverAI News.
PouroverAI News

No Result
View All Result
  • Home
  • AI Tech
  • Business
  • Blockchain
  • Data Science & ML
  • Cloud & Programming
  • Automation
  • Front-Tech
  • Marketing

Copyright © 2023 PouroverAI News.
PouroverAI News

Welcome Back!

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Fill the forms bellow to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In