mrfdn.com – File ENV biasanya digunakan untuk menentukan nama proyek kita.
Dengan membuat file env, proyek akan jauh lebih aman, bersih, dan pemeliharaannya lebih mudah.
Di sini saya ingin mengatur file ENV di proyek SvelteKit yang saya buat kemarin yaitu tentang menampilkan data dari database dengan menyembunyikan jalur database.
Langsung saja, lakukan seperti ini:
- Di folder root proyek sveldekit, buat file bernama
.envGunakan titik di depannya untuk menjadikannya file tersembunyi nantinya. Kemudian isi file tersebut dengan lokasi file database.db:
DB_PATH=./src/database/mydatabase.db
- Kemudian edit file tersebut
+server.jsJadi menjadi seperti ini:
import { DB_PATH } from '$env/static/private';
import { error, json } from '@sveltejs/kit';
import Database from "better-sqlite3";
let db = new Database(DB_PATH, { verbose: console.log });
export function GET() {
const items = db.prepare("select * from mytable");
return json(items.all());
}
selesai
Sekarang coba jalankan servernya lalu pastikan semuanya berjalan normal sebelum menambahkan file .env.
Semoga bermanfaat.
PakarPBN
A Private Blog Network (PBN) is a collection of websites that are controlled by a single individual or organization and used primarily to build backlinks to a “money site” in order to influence its ranking in search engines such as Google. The core idea behind a PBN is based on the importance of backlinks in Google’s ranking algorithm. Since Google views backlinks as signals of authority and trust, some website owners attempt to artificially create these signals through a controlled network of sites.
In a typical PBN setup, the owner acquires expired or aged domains that already have existing authority, backlinks, and history. These domains are rebuilt with new content and hosted separately, often using different IP addresses, hosting providers, themes, and ownership details to make them appear unrelated. Within the content published on these sites, links are strategically placed that point to the main website the owner wants to rank higher. By doing this, the owner attempts to pass link equity (also known as “link juice”) from the PBN sites to the target website.
The purpose of a PBN is to give the impression that the target website is naturally earning links from multiple independent sources. If done effectively, this can temporarily improve keyword rankings, increase organic visibility, and drive more traffic from search results.