+page.server.js for Server-Only Logic
Keep secrets and database calls on the server by using +page.server.js.
Why Server-Only
Some data must stay on the server: database calls, secret API keys, file system access.
File Name
Use +page.server.js instead of +page.js.
All lessons in this course
- +page.js load Function
- Returning Data and Using $page.data
- Error Handling in load
- +page.server.js for Server-Only Logic