You are describing a limerick. Limericks typically have a specific structure with five lines, an AABBA rhyme scheme, and a rhythm that often makes them humorous. Here’s an example of a limerick:
There once was a cat from the coast (A)
Who loved to eat buttered toast. (A)
But one day in a bind, (B)
She got stuck in a rind, (B)
Now she only eats jam, not a roast! (A)