How packtpublishing/mastering-node.js-web-development works
This repository is the chapter-by-chapter code accompanying a Node.js web-development book, not one continuously versioned application. Its culminating example is SportsStore: users browse a catalog and place orders, while administrators manage store data. The tree documents earlier examples of templating, forms, persistence, sessions, REST APIs, and authentication. Sampled source confirms ORM persistence for catalog entities and orders; the precise wiring among the unsampled application layers is therefore not shown.
Main entry points: src Store client · src/server.ts SportsStore server · server/server.ts HTTP handling · catalog.ts Catalog routes
Components 20
SportsStore
- SportsStore server
Chapter 16/sportsstore/src/server.ts - Catalog routes
Chapter 16/sportsstore/src/routes/catalog.ts - Store client
Chapter 16/sportsstore/src - Cart and orders
Chapter 21/End of Chapter/sportsstore/src
Store data
- Catalog repository
Chapter 16/sportsstore/src/data/catalog_repository.ts - Catalog ORM storage
Chapter 16/sportsstore/src/data/orm/storage.ts - Catalog models
Chapter 16/sportsstore/src/data/orm/models/catalog_models.ts - ORM database
- Order persistence
Chapter 21/End of Chapter/sportsstore/src/data/orm/order_storage.ts
Server features
- HTTP handling
Chapter 11/End of Chapter/part2app/src/server/server.ts - Form handling
Chapter 11/End of Chapter/part2app/src/server/forms.ts - Data access
Chapter 12/End of Chapter/part2app/src/server/data/repository.ts - Session handling
Chapter 13/End of Chapter/part2app/src/server/sessions/middleware.ts - Custom templates
Chapter 10/End of Chapter/part2app/src/server/custom_engine.ts
API and identity
- REST API
Chapter 14/End of Chapter/part2app/src/server/api/results_api.ts - API validation
Chapter 14/End of Chapter/part2app/src/server/api/results_api_validation.ts - Authentication
Chapter 15/End of Chapter/part2app/src/server/auth/index.ts - Auth storage
Chapter 15/End of Chapter/part2app/src/server/auth/orm_authstore.ts
Other components
- Shopper
- Administrator
Connections 16
- Shopper → Store client: uses
- Store client → SportsStore server: HTTP requests
- SportsStore server → Catalog routes: routes requests
- Catalog routes → Catalog repository: catalog access
- Catalog repository → Catalog ORM storage: storage operations
- Catalog ORM storage → Catalog models: upserts entities
- Catalog models → ORM database: ORM persistence
- Administrator → SportsStore server: uses
- Store client → Cart and orders: submits orders
- Cart and orders → Order persistence: stores order
- Order persistence → ORM database: transactional writes
- HTTP handling → Form handling: handles forms
- Form handling → Data access: uses repository
- HTTP handling → Session handling: middleware
- REST API → API validation: validates input
- Authentication → Auth storage: uses storage