As the days become warmer, Philadelphians start heading to the beaches. Traveling to coastal communities from southern Delaware to the New Jersey coast, Philly residents escape the landlocked bustle of the city for sun, recreation, and relaxation at nearby shores. With its free beaches and casino industry, Atlantic City ranks among the more popular of these destinations. Now that Atlantic City's casinos will offer sports gambling after a recent Supreme Court ruling, the city may witness an uptick of Southeastern Pennsylvania visitors this season.

Despite the lure of quick riches, Atlantic City's popularity as a summer destination predates its emergence as a hub for gambling. Its origins trace back to the rise of the United States' middle class during the 19th century, when a growing number of U.S. citizens had access to disposable income and leisure time.

The wealthy already enjoyed vacationing at the beach, with towns like Cape May offering luxurious accommodations and amenities for those who could afford it. In the 1850s, a group of developers worked with a New Jersey resident, Dr. Jonathan Pitney, to capitalize on this concept by building a new tourism-oriented beach destination easily accessed by Philadelphia's growing middle class. By 1854, the group had completed the Camden-Atlantic rail line, effectively connecting Philadelphia to the Atlantic Ocean.

>> READ MORE: 2018 Shore Guide

In its early days, Atlantic City attracted scores of visitors seeking reprieve from the increasingly congested and polluted urban centers around the region. Popular medicine at the time extolled sun and recreation as pillars of health, and Atlantic City represented to many middle-class families in Southeastern Pennsylvania and New Jersey an ideal location for rejuvenation. The city's fame as a revitalizing retreat inspired in part its most iconic landmark: the Boardwalk.

Atlantic City built the nation's first boardwalk in 1870, primarily so individuals could enjoy the touted health benefits of the beach without collecting sand in their shoes and clothes, a constant source of frustration among hotel operators and train conductors. The concept was a hit.

As inclement weather washed away one boardwalk after another throughout the last decades of the 19th century, the city kept reinstalling new ones until finally, in 1896, officials constructed a deluxe, steel-enforced boardwalk. What began as a one-mile stretch in its first iteration became a five-mile long promenade by the turn of the century, boasting a variety of entertainment options and inviting a new wave of commercial development and tourism.

The Boardwalk bridged two eras of tourism in Atlantic City. While originally promoted as one of the city's health benefits, it became the focal point of development in the 20th century, replete with urban infrastructure accommodating modern forms of entertainment. Entering the 1920s, Atlantic City became a staple of the nation's theater scene, hosting Broadway-caliber shows. In 1921, Atlantic City hosted the first-ever Miss America Pageant. Atlantic City clubs hosted talent including Dean Martin, Jerry Lewis, and Frank Sinatra over the following decades.

But not everyone could fully access Atlantic City's attractions. The city remained staunchly segregated throughout the first half of the 20th century. While many African Americans worked in the city's sizable service industry, they were barred from its hotels, beaches, and restaurants throughout the city's heyday.

While Atlantic City's fame and allure continued into the 1950s — drawing international celebrities from the Beatles to Marilyn Monroe — it began to suffer as affordable air travel sent middle-class vacationers off to southern Florida and the Caribbean. Gambling legalization in the late 1970s raised hopes for a grand urban renewal, but despite ascending to third in the nation for most resort visitors during the 1990s, Atlantic City still struggled. The 2008 recession and Hurricane Sandy in 2012 dealt the city additional blows.

But the city has persevered. This summer Atlantic City will complete the reconstruction of its historic Boardwalk damaged by Hurricane Sandy. The Hard Rock casino resort will open in the vast, empty structure left by the failed Taj Mahal. A sign of cultural resurgence, the city will also host the second annual 48 Blocks, a massive, free arts festival in June designed to celebrate local artists and communities.

Patrick Glennon is a communications officer at the Historical Society of Pennsylvania. pglennon@hsp.org