SShortSingh.
Back to feed

FastAPI 0.138–0.141 adds app.frontend() to fix silent SPA routing conflicts

0
·53 views

FastAPI versions 0.138.0 through 0.141.1, released between June 20 and July 29 this year, introduced a new app.frontend() method to simplify serving single-page applications alongside API routes. Previously, developers had to either mount StaticFiles at '/' or write a manual catch-all route, both of which could silently intercept API calls if declared in the wrong order. The new method stores frontend routes internally as low-priority entries, ensuring they are only evaluated after all standard API routes have been checked, regardless of where app.frontend() appears in the code. It also inspects the HTTP Accept header before falling back to index.html, returning a proper 404 for non-browser requests to missing assets instead of silently serving the SPA shell. This makes SPA serving in FastAPI a routing guarantee rather than a convention dependent on file order.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

APIOps for Azure API Management: Extracting, Reviewing and Publishing with the CLI

Portal edits to an Azure API Management instance can be silently overwritten when Bicep redeploys the same policy, leaving no record of the change. The article proposes APIOps, which stores APIs, policies and products as files that can be reviewed through pull requests. Ownership is split so Bicep manages the platform while APIOps manages the API surface, controlled by a new apiSurfaceOwner parameter that defaults to bicep. The sample uses the APIOps CLI version 1.0.5, extracting live resources with a filter and running GitHub Actions workflows for nightly extraction and approved publishing. The author notes that nothing was deployed, and that behaviour on a live instance is described only where stated.

0
ProgrammingDEV Community ·

Binance hack reportedly started with fake job interviews targeting developers

Reports indicate that the Binance breach began with attackers posing as recruiters in fake job interviews. The intruders reportedly compromised developers' devices through this channel. From those devices, they allegedly reached internal wallet infrastructure. The theft involved billions of dollars. The episode is cited as a reminder that technical defences alone cannot guard against every breakdown of trust inside an organisation.

0
ProgrammingDEV Community ·

Explainer on Crypto Swaps: Exchanging USDT, TRX and Other Tokens Safely

Crypto swaps let users trade one digital asset directly for another through a swap service or decentralized exchange, rather than converting to traditional money first. The process involves exchange rates, liquidity, network fees, slippage and token standards that can affect the final outcome. The article highlights the TRON network, commonly used for USDT transfers via the TRC20 standard, and warns that USDT on TRON is not interchangeable with USDT on networks like Ethereum. It outlines typical swap steps, from selecting assets and reviewing fees and limits to confirming the transaction and checking it on a blockchain explorer. It also distinguishes centralized exchanges, which hold user funds and manage trading, from decentralized exchanges.

0
ProgrammingDEV Community ·

agent-browser gives AI agents a command-line browser that returns compact page snapshots

Vercel Labs has published agent-browser, a native Rust command-line tool that lets AI agents control a browser one shell command at a time. Pages are returned as text listing interactive elements tagged with short references, and the browser stays open between commands through a background daemon driving Chrome via the DevTools Protocol. The tool fails loudly when a target is covered, hidden, disabled, or off-screen, and references expire after navigation or DOM changes, requiring fresh snapshots. It can also be reached through an MCP server, and it supports local Chrome for Testing, alternative engines, iOS Simulator, and cloud browser providers. The project, under an Apache-2.0 license, was created in January 2026 and is still being actively updated.