node.js - NodeJs 到 Typescript
问题描述
我需要在我的角度项目中使用 nodejs 库,但在 nodejs 中获得了示例代码。我已经通过 npm 命令安装了库并导入到我的组件中。但它总是显示未定义。
npm install phenix-edge-auth --save
const TokenBuilder = require('phenix-edge-auth');
// Create a token to access a channel
const token = new TokenBuilder()
.withApplicationId('my-application-id')
.withSecret('my-secret')
.expiresInSeconds(3600)
.forChannel('us-northeast#my-application-id#my-channel.1345')
.build();
如何将此代码与角度应用程序一起使用?
解决方案
以角度方式导入它..
import * as TokenBuilder from 'phenix-edge-auth'
推荐阅读
- logging - 如何在 Fluentd 配置中定义哈希(JSON 或对象)?
- sql - 在 SQL Server 中动态转换更新语句值
- reactjs - 无法将类型分配给 React 高阶组件
- python - 根据Python中的第二个列表调整列表中的元素
- linux - 使用 rsync 自动同步
- python - 如何使用 APScheduler 管理任务队列?
- xaml - 根据参数调整ListView中的文本大小
- java - 如何通过收集器分组以从数据中创建新字段?
- c++ - c++ std::vector: sum in a vector position its previous value
- nginx - Kubernetes - 入口控制器与入口