🛣️ Identity Route Blocks
Identity route blocks provide pre-configured HTTP endpoints for identity management operations in NodeBlocks applications. These routes combine blocks, validators, and middleware to create complete API endpoints with proper authentication, authorization, and error handling.
🎯 Overview
Identity route blocks are designed to:
- Provide complete API endpoints for identity management operations
- Combine blocks with validators for secure operations
- Include authentication and authorization checks
- Support functional composition patterns
- Handle logging and error management automatically
📋 Route Structure
Each identity route follows a consistent pattern:
- HTTP Method: Defines the operation type (GET, PATCH, DELETE)
- Path: Specifies the endpoint URL with parameters
- Handler: Composed function chain for business logic
- Validators: Authentication and authorization checks
🔧 Available Identity Routes
getIdentityRoute
Retrieves a specific identity by ID.
Purpose: Fetches identity data with access control
Route Details:
- Method:
GET
- Path:
/identities/:identityId
- Authentication: Required (Bearer token)
Blocks: getIdentityById
, getIdentityTerminator
Validators: isAuthenticated
, checkIdentityType
(['admin'])
Usage:
import { routes } from '@nodeblocks/backend-sdk';
// Register route with Express app
app.use('/api', routes.getIdentityRoute);
findIdentitiesRoute
Retrieves all identities with normalized list format.
Purpose: Lists identities with pagination and admin-only access
Route Details:
- Method:
GET
- Path:
/identities
- Authentication: Required (Bearer token)
Blocks: findIdentities
, findIdentitiesTerminator
Validators: isAuthenticated
, checkIdentityType
(['admin'])
Usage:
import { routes } from '@nodeblocks/backend-sdk';
// Register route with Express app
app.use('/api', routes.findIdentitiesRoute);
updateIdentityRoute
Updates an existing identity and returns the updated resource.
Purpose: Modifies identity data with access control
Route Details:
- Method:
PATCH
- Path:
/identities/:identityId
- Authentication: Required (Bearer token)
Blocks: updateIdentity
, getIdentityById
, getIdentityTerminator
Validators: isAuthenticated
, checkIdentityType
(['admin'])
Usage:
import { routes } from '@nodeblocks/backend-sdk';
// Register route with Express app
app.use('/api', routes.updateIdentityRoute);
deleteIdentityRoute
Deletes an identity by ID.
Purpose: Removes identity with access control
Route Details:
- Method:
DELETE
- Path:
/identities/:identityId
- Authentication: Required (Bearer token)
Blocks: deleteIdentity
, deleteIdentityTerminator
Validators: isAuthenticated
, checkIdentityType
(['admin'])
Usage:
import { routes } from '@nodeblocks/backend-sdk';
// Register route with Express app
app.use('/api', routes.deleteIdentityRoute);
🔗 Related Documentation
- Identity Schema Blocks - Identity data validation and contracts
- Identity Blocks - Identity business logic functions