Update quickstart example

This commit is contained in:
Tuan Dang
2023-04-23 15:51:42 +03:00
parent aacdaf4556
commit 9e42a7a33e
2 changed files with 7 additions and 7 deletions

View File

@ -64,9 +64,9 @@ These examples demonstrate how to store and fetch environment variables from [In
### Initialize the Infisical client
```js
import infisical from "infisical-node";
import InfisicalClient from "infisical-node";
infisical.connect({
const client = new InfisicalClient({
token: "your_infisical_token",
});
```
@ -74,25 +74,25 @@ These examples demonstrate how to store and fetch environment variables from [In
### Get a value
```js
const value = await infisical.getSecret("SOME_KEY");
const value = await client.getSecret("SOME_KEY");
```
### Example with Express
```js
import infisical from "infisical-node";
import InfisicalClient from "infisical-node";
import express from "express";
const app = express();
const PORT = 3000;
await infisical.connect({
const client = InfisicalClient({
token: "st.xxx.xxx",
});
// your application logic
app.get("/", async (req, res) => {
const name = await infisical.getSecret("NAME");
const name = await client.getSecret("NAME");
res.send(`Hello! My name is: ${name.secretValue}`);
});

View File

@ -2,7 +2,7 @@
title: "Node"
---
If you're working with Node.js, the official [infisical-node](https://github.com/Infisical/infisical-node) package is the easiest way to fetch and work with ecrets for your application.
If you're working with Node.js, the official [infisical-node](https://github.com/Infisical/infisical-node) package is the easiest way to fetch and work with secrets for your application.
## Installation