Performance: Why APIs serve modern applications
MEDIUM IMPACT
APIs affect how fast data loads and updates in modern apps, impacting user experience and page responsiveness.
Route::get('/api/data', function() { return response()->json(App\Models\Model::all()); });
Route::get('/data', function() { return view('data-page'); });
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Full page reload for data | High (full DOM rebuild) | Multiple reflows | High paint cost | [X] Bad |
| API JSON fetch with client rendering | Low (partial DOM update) | Single reflow | Low paint cost | [OK] Good |