The @neondatabase/api-client library is a wrapper for the Neon API. It provides a convenient way to interact with the Neon API using TypeScript.
You can install the library using npm or yarn.
npm:
npm install @neondatabase/api-clientyarn:
yarn add @neondatabase/api-clientTo get started with the @neondatabase/api-client library, follow these steps:
-
Obtain an API key from the Developer Settings page in the Neon Console.
-
Click Generate new API key.
-
Enter name for your API key and click Create.
-
Save your API key to a secure location that enables you to pass it to your code.
-
Import the library:
import { createApiClient } from '@neondatabase/api-client';
-
Create an instance of the API client by calling the
createApiClientfunction:const apiClient = createApiClient({ apiKey: 'your-api-key', });
-
Use the
apiClientinstance to make API calls. For example:const response = await apiClient.listProjects({}); console.log(response);
Since the client is based on axios library, createApiClient additionally accepts axios request options.
The @neondatabase/api-client library is licensed under the MIT License. For more information, see the LICENSE file.