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