SShortSingh.
Back to feed

Nuxt Endpoints library brings typed, contract-driven DX to explicit HTTP routes

0
·1 views

A developer has built Nuxt Endpoints (NE), an experimental library that adds server-function-style developer experience to standard HTTP routes in Nuxt without abstracting away URLs or HTTP methods. The library introduces a defineRouteHandler() utility that attaches request and response schemas directly to route handlers, drawing on a design proposed in the H3 RFC #1437. NE extends this contract to support features like cursor-based pagination, where the client adapter enforces at compile time that the target route actually declares pagination. Client-side integration with Pinia Colada allows infinite queries using typed endpoints, while status-based type narrowing lets developers handle responses like 404s as typed results rather than thrown errors. Because routes remain standard HTTP endpoints, they are also accessible via curl or other services, with contracts automatically documented through generated OpenAPI output.

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 ·

How LLM Context Windows Work and Why AI Forgets Mid-Conversation

Large language models rely on a fixed 'context window' — a working memory limit that determines how much text, code, or instructions the model can actively process at once. Unlike human long-term memory, LLMs re-read the entire conversation from scratch with every new message, meaning older content gets dropped once the limit is exceeded. When earlier context falls outside this window, the model can no longer reference it, which often leads to hallucinations, contradictions, or re-introduction of previously fixed errors. Context windows are measured in tokens — small text units produced by a tokenizer — where roughly 100 English words translate to about 150 tokens. Modern transformer-based LLMs also use contextual embeddings, which represent words as dynamic numerical vectors that shift meaning based on surrounding text, enabling more nuanced language understanding within the available window.

0
ProgrammingDEV Community ·

SWE-Gate Benchmark Reveals 34% of AI-Generated Patches Fail Code Review Standards

A new benchmark called SWE-Gate has been introduced to address a critical gap in how AI coding agents are evaluated, measuring not just whether generated patches pass functional tests but also whether they meet real-world code review requirements. The benchmark was built using 303 repair tasks across 75 Python repositories, with review constraints derived from actual pull request comments on merged code. Existing tools like SWE-bench only check if an agent's patch resolves a GitHub issue by passing the test suite, ignoring review criteria such as style rules, security boundaries, and architectural patterns. In a study of 644 agent-generated patches that passed functional tests, 221 — roughly 34% — failed to meet review constraints, exposing a significant blind spot in current benchmarks. SWE-Gate scores agents on a two-stage tuple of functional correctness and constraint compliance, offering a more production-realistic measure of code quality.

0
ProgrammingDEV Community ·

CodeBehind 4.7 Replaces Direct Form Access with Safer IfForm Extension Method

CodeBehind version 4.7 changes how developers handle Form data in incoming HTTP requests by removing the internal structure that previously injected Form data into every request. Direct access via context.Request.Form is no longer supported, as it throws an error when the request contains no Form content, such as a GET request. To address this, the update introduces the IfForm extension method, which safely checks for Form content before attempting to read any values. Developers are advised to replace legacy Form-access conditions with IfForm to avoid runtime errors and unnecessary processing overhead. The change aligns with CodeBehind's controller-based request handling pattern, where Form data checks drive event execution inside the PageLoad method.

0
ProgrammingDEV Community ·

C++ Cache Bug: Duplicate Expiry Timestamps Can Silently Erase Map Entries

A subtle bug in C++ std::map usage can cause live cache entries to be silently dropped when two keys share the same expiry timestamp. The issue arises when a custom comparator relies solely on expiry time for ordering, violating the strict weak ordering requirement if no tiebreaker is included. When two entries share an identical expiry second, the map treats them as the same key, causing one to overwrite or disappear entirely. The recommended fix is to separate identity from eviction policy — use a plain map keyed by ID and manage expiry through a separate heap or scan. Developers are advised to always test comparators with forced timestamp collisions and enable sanitizers rather than relying on incidental timing differences to mask the flaw.