### Install kysely-neon for Node.js Source: https://github.com/seveibar/kysely-neon/blob/main/README.md Installs the necessary packages for using kysely-neon in Node.js environments. This setup includes the 'ws' package, which is required for WebSocket support in Node.js. ```bash npm i kysely-neon kysely @neondatabase/serverless ws ``` -------------------------------- ### Install kysely-neon for Edge Runtime Source: https://github.com/seveibar/kysely-neon/blob/main/README.md Installs the necessary packages for using kysely-neon with Edge runtime environments, such as Vercel Edge or Cloudflare Workers. This setup does not require the 'ws' package. ```bash npm i kysely-neon kysely @neondatabase/serverless ``` -------------------------------- ### Configure Kysely with NeonDialect for Node.js Source: https://github.com/seveibar/kysely-neon/blob/main/README.md Illustrates how to initialize Kysely with the NeonDialect for Node.js environments. This example includes the 'ws' import and specifies the 'webSocketConstructor' option for proper WebSocket support, defining a database schema and performing an insert operation. ```typescript import { GeneratedAlways, Kysely } from "kysely" import { NeonDialect } from "kysely-neon" import ws from "ws" interface Database { person: PersonTable } interface PersonTable { id: GeneratedAlways first_name: string gender: "male" | "female" | "other" } const db = new Kysely({ dialect: new NeonDialect({ connectionString: process.env.DATABASE_URL, webSocketConstructor: ws, }), }) await db .insertInto("person") .values({ first_name: "Jennifer", gender: "female" }) .returning("id") .executeTakeFirstOrThrow() ``` -------------------------------- ### Configure Kysely with NeonDialect for Edge Runtime Source: https://github.com/seveibar/kysely-neon/blob/main/README.md Demonstrates how to initialize Kysely with the NeonDialect for use in Edge runtime environments. It defines a simple database schema for a 'person' table and shows an example of inserting data, connecting via a connection string from environment variables. ```typescript import { GeneratedAlways, Kysely } from "kysely" import { NeonDialect } from "kysely-neon" interface Database { person: PersonTable } interface PersonTable { id: GeneratedAlways first_name: string gender: "male" | "female" | "other" } const db = new Kysely({ dialect: new NeonDialect({ connectionString: process.env.DATABASE_URL, }), }) await db .insertInto("person") .values({ first_name: "Jennifer", gender: "female" }) .returning("id") .executeTakeFirstOrThrow() ``` -------------------------------- ### Configure Kysely with Experimental NeonHTTPDialect Source: https://github.com/seveibar/kysely-neon/blob/main/README.md Shows how to use the experimental NeonHTTPDialect for Kysely, which enables making stateless HTTPS requests to Neon. This dialect can offer lower latencies but does not support sessions or transactions. It includes a schema definition and an example insert operation. ```typescript import { GeneratedAlways, Kysely } from "kysely" import { NeonHTTPDialect } from "kysely-neon" interface Database { person: PersonTable } interface PersonTable { id: GeneratedAlways first_name: string gender: "male" | "female" | "other" } const db = new Kysely({ dialect: new NeonHTTPDialect({ connectionString: process.env.DATABASE_URL, }), }) await db .insertInto("person") .values({ first_name: "Jennifer", gender: "female" }) .returning("id") .executeTakeFirstOrThrow() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.