[docs] change server module example to be more realistic
Nobody has claimed this yet.
- #16102 by @starkmarkus — closed without merging
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the bug
Problem
export const atlantisCoordinates = [/* redacted */];https://svelte.dev/docs/kit/server-only-modules#How-it-works
The above can lead users to think that variables / secrets should be stored in a $lib/server/secrets.js when an environment variable is more appropriate.
Proposed Solution
Change the example to show business logic or DB connection
// $lib/server/db.js
export const db = sql(...)
<script>
// src/routes/+page.svelte
import { db} from './utils.js';
</script>
Reference
https://discord.com/channels/457912077277855764/1336063679275208814
Reproduction
.
Logs
System Info
.
Severity
annoyance
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the server-only-modules documentation section linked in the issue and inspect the current atlantisCoordinates example. Replace it with a realistic business-logic or database-connection example, keeping the accompanying Svelte import example consistent; the documentation is done when it no longer suggests storing secrets in a server module.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100