-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ae09c4
commit 49b5864
Showing
5 changed files
with
80 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
title: "gRPC Connections" | ||
--- | ||
|
||
gRPC is a high-performance, open-source, universal RPC framework that enables efficient communication between services. With gRPC support, you can build real-time, interactive applications that leverage the low-latency communication capabilities of gRPC. | ||
|
||
Deno supports gRPC connections using the `@grpc/grpc-js` client library from npm. This enables you to connect to gRPC services, such as Google Cloud Platform, directly from Deno. For example, you can classify an image using the Google Cloud Vision API: | ||
|
||
```typescript title="classifyImage.ts" | ||
|
||
import { ImageAnnotatorClient } from "npm:@google-cloud/vision"; | ||
|
||
const client = new ImageAnnotatorClient(); | ||
const [result] = await client.labelDetection("./cat_dog.webp"); | ||
const labels = result.labelAnnotations; | ||
console.log("Labels:"); | ||
for (const label of labels) { | ||
console.log(" - ", label.description); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
title: "Private Registries" | ||
--- | ||
|
||
Deno supports private registries, which allow you to host and share your own | ||
modules. This is useful for organizations that want to keep their code private | ||
or for individuals who want to share their code with a select group of people. | ||
|
||
## What are private registries? | ||
|
||
Large organizations often host their own private npm registries to manage internal packages securely. These private registries serve as repositories where organizations can publish and store their proprietary or custom packages. Unlike public npm registries, private registries are accessible only to authorized users within the organization. | ||
|
||
## How to use private registries with Deno | ||
|
||
First, configure your `.npmrc` file to point to your private registry. You can do this by adding the following line to your `.npmrc` file: | ||
|
||
```sh | ||
@mycompany:registry=http://mycompany.com:8111/ | ||
//mycompany.com:8111/:_auth=secretToken | ||
``` | ||
|
||
Replace `http://mycompany.com:8111/` with the actual URL of your private registry and `secretToken` with your authentication token. | ||
|
||
Then update Your `deno.json` or `package.json` to specify the import path for your private package. For example: | ||
|
||
```json title="deno.json" | ||
{ | ||
"imports": { | ||
"@mycompany/package": "npm:@mycompany/[email protected]" | ||
} | ||
} | ||
``` | ||
|
||
or if you're using a `package.json`: | ||
|
||
```json title="package.json" | ||
{ | ||
"dependencies": { | ||
"@mycompany/package": "1.0.0" | ||
} | ||
} | ||
``` | ||
|
||
Now you can import your private package in your Deno code: | ||
|
||
```typescript title="main.ts" | ||
import { hello } from "@mycompany/package"; | ||
|
||
console.log(hello()); | ||
``` | ||
|
||
and run it using the `deno run` command: | ||
|
||
```sh | ||
deno run main.ts | ||
``` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters