Skip to content

[docs] change server module example to be more realistic #13416

@sacrosanctic

Description

@sacrosanctic

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions