JSON REST API Complete Guide
Welcome to the comprehensive guide for JSON REST API. This guide will walk you through everything from initial setup to advanced features.
Table of Contents
Core Chapters
-
Initial Setup
Get started with JSON REST API, create your first API instance, and understand the basic concepts. -
Data and Relations
Learn how to define resources, set up relationships, and work with your data model. -
Field Transformations
Transform data with virtual fields, getters, setters, computed fields, and visibility control. -
Non-Database Resources
Connect your API to alternative data sources beyond traditional databases. -
Positioning
Implement drag-and-drop functionality with automatic position management. -
Hooks, Data Management, and Plugins
Master the hook system for data validation, transformation, and business logic.
Additional Topics
-
File Uploads
Handle file uploads with multiple backends (file system, S3). -
Bulk Operations
Handle multiple records efficiently with bulk create, update, and delete operations. -
CORS Configuration
Set up Cross-Origin Resource Sharing for browser-based applications. -
Autofiltering
Scope datasets automatically using configured context values, without baking in auth semantics. -
Knex Schema and Migrations
Create tables, inspect live table snapshots, and generate create or additive diff migrations from table-backed resource scopes. -
Query Projections
Use the optional query-projections plugin to add SQL-backed, output-only derived fields that can participate in sorting and cursor pagination. -
Writing Plugins
Build plugins against the supported extension surface, including hooks, scope methods, and query-only read fields. -
Fastify Integration
Register REST routes on Fastify and reject malformed write payloads at the transport layer using exported resource schemas. -
Socket.IO Integration
Add real-time capabilities to your API with WebSocket support. -
URL Management
Configure URL generation for proxies, CDNs, and multi-tenant scenarios. -
Appendices
Reference material, troubleshooting, and additional resources.
Prerequisites
Before starting this guide, you should have:
- Node.js 20+ installed
- Basic knowledge of JavaScript and REST APIs
- Familiarity with npm/yarn package management
Ready to get started? Head to Chapter 1: Initial Setup →