小编Wil*_*ian的帖子

与 react-navigation v5 的深层链接

我正在尝试在带有反应导航的反应本机项目中使用深层链接,但我在两个平台(ios 和 android)中都遇到了一些奇怪的场景。

我的代码导航容器

const linking = {
        prefixes: ['https://latineo.com', 'latineo://'],
        config: {
            Home: {
                path: 'homestack',
                initialRouteName: 'Explore',
                screens: {
                    Explore: 'explore',
                    Posts: 'posts',
                    Favorites: 'favorites',
                    Settings: 'settings',
                },
            },
            ExploreOptions: {
                path: 'explorestack',
                initialRouteName: 'Restaurants',
                screens: {
                    Restaurants: 'rts',
                    ShowRestaurants: 'restaurants',
                    ShowRestaurant: 'restaurant/:id',
                },
            }
        },
    };

<NavigationContainer
            theme={navigatorTheme}
            ref={(nav: any) => {
                navigator = nav;
                NavigationService.setNavigator(navigator);
            }}

            linking={linking}
            fallback={<LoadingIndicator
                size='giant'
            ></LoadingIndicator>}
            onStateChange={(nav) => {
                console.log("AppNavigator -> nav", nav)
            }}
        >
            {isAuth && <HomeNavigator />}
            {!isAuth && didTryAutoLogin …
Run Code Online (Sandbox Code Playgroud)

deep-linking typescript react-native react-navigation

7
推荐指数
0
解决办法
1326
查看次数

无法使用 nodemailer (gmail) 启动邮件线程(回复邮件)

我正在使用 nodemailer 发送电子邮件。但我想回复邮件(开始一个新线程)。我尝试使用以下代码发送邮件回复

var nodemailer = require('nodemailer');

const subject = 'Hey I am test';

var transporter = nodemailer.createTransport({
  service: 'gmail',
  auth: {
    user: '*******',
    pass: '*******'
  }
});

const mailOptions = {
  from: 'mymail@gmail.com',
  to: 'receiver@gmail.com',
  subject,
  text: 'Body',
};

transporter.sendMail(mailOptions, function (error, info) {
  if (error) {
    console.log(error);
  } else {
    console.log(info.messageId);
    const threadOptions = {
      from: 'mymail@gmail.com',
      to: 'receiver@gmail.com',
      subject:'Re: ' + subject,
      text: 'This is reply',
      inReplyTo: info.messageId,
      references: [info.messageId]
    };
    transporter.sendMail(threadOptions);
  }
});

Run Code Online (Sandbox Code Playgroud)

但它是作为新邮件发送的。在使用inReplyTo的 …

javascript email gmail email-threading nodemailer

5
推荐指数
1
解决办法
161
查看次数

由于 TypeOrmModule 没有准确的错误消息,Heroku 上构建的 NestJS 应用程序崩溃

我有一个基于 NestJS 构建的工作应用程序,它部署在 Heroku 服务器上。它曾经有效,直到最近我所做的每个构建都无缘无故地崩溃了。我做了一些试验,发现该应用程序在TypeOrmModule不包含在AppModule导入中时可以工作,但显然如果没有数据库它就无法使用。配置如下AppModule

const databaseUrl = process.env.DATABASE_URL;
@Module({
  imports: [
    TypeOrmModule.forRoot(databaseUrl ? {
      type: 'postgres',
      url: databaseUrl,
      entities: [__dirname + '/**/*.entity{.ts,.js}'],
      synchronize: true,
   } : {
      // configuration for local development
   }),
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
Run Code Online (Sandbox Code Playgroud)

我已经检查过并且databaseUrl正在从环境 URL 正确加载。这不是一个剥离的展示示例,这实际上是我部署到 Heroku 的内容 - 我已经删除了所有其他模块以了解问题的根源。如果我现在删除TypeOrmModule该应用程序将不会崩溃。这是 heroku 在崩溃时向我提供的无用日志:

07/08/2020, 12:09:13 PM [NestFactory] ​​启动 Nest 应用程序... 2020-07-08T12:09:13.300817+00:00 app[web.1]: [Nest] 23
07/08/2020 , 12:09:13 PM …

heroku typescript nestjs

5
推荐指数
1
解决办法
1730
查看次数

GraphQL &amp; 使用嵌套订阅功能

我正在编写一个 graphql 订阅服务器。如果我编写一个查询,将解析器嵌套在另一个中是没有问题的,因此查询将如下所示:

query {
  messages {
    privateMessage {
      id
      message
      userId
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

所以首先messages执行解析器,然后privateMessage执行解析器。我想知道订阅是否可以实现相同的结构,因此它看起来像这样:

subscription {
  messages {
    privateMessage {
      id
      message
      userId
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

编辑:

这是我拥有的当前根订阅模式:

query {
  messages {
    privateMessage {
      id
      message
      userId
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我希望它看起来像这样:

subscription {
  messages {
    privateMessage {
      id
      message
      userId
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

编辑结束

问题是我让messages订阅功能运行但没有privateMessage订阅功能运行。很想知道它是否可能以及如何实现它。因为我是用 node.js 编写的,所以我很感激 js 中的一个例子,但任何指向解决方案的指针都会有所帮助。提前致谢!

javascript graphql

5
推荐指数
1
解决办法
188
查看次数

使用 Future 时程序不会终止

我试图对目录中的每个文件同时运行一个函数。可悲的是,每当我使用 Futures 时,我的程序都不想终止(永远运行)。我尝试过使用Await.result()相同的结果:/

运行代码时,它执行得很好,甚至“完成?” 被打印然后挂起......

这是我的代码。(我是 Scala 新手)

val execService = Executors.newFixedThreadPool(3)
implicit val execContext = ExecutionContext.fromExecutorService(execService)

val futures = for (file <- filesList) yield Future {
   println(file)
   // theFunc(file)
}
val seq = Future.sequence(futures)
seq.onComplete {
   case Success(x) => println("finish?")
   case Failure(e) => println(e)
}
Run Code Online (Sandbox Code Playgroud)

concurrency scala future file

5
推荐指数
1
解决办法
444
查看次数

NestJS 的 i18n 意见

我目前正在开发一个使用 Angular/NestJS 的项目。我们已经使用 ngx-translate 在 Angular 中实现了 i18n,这很棒,我想知道在 NestJS 中实现 i18n 的最佳方法是什么。我发现了一个类似的问题,但这里唯一的答案是使用i18-node,然后围绕它实现自定义装饰器、包装器等,以将其与 Nest 一起使用。

我想知道在 NestJS 中是否有一些“固执己见”的方法来实现 i18?另外,如果“最佳”方法是使用 i18-node,我应该构建什么装饰器/包装器?

localization internationalization node.js nestjs

2
推荐指数
1
解决办法
1万
查看次数

dotnet-ef 不存在 - Windows 10 WSL (Ubuntu)

我一直在不同的操作系统(如WindowsLinux(Ubuntu) )中测试 dotnet core 3 。所有这些都可以与 EF Core 一起正常工作!

但是,我决定给Windows WSL - Linux 的 Windows 子系统一个机会,看看它是如何工作的。这就是为什么我在这里!

WSL 和 Ubuntu 18.04 的问题是:

我全局安装了 EF Core 并重新启动了终端。* 截至目前,EF 版本为 3.1.4

> dotnet tool install --global dotnet-ef
Run Code Online (Sandbox Code Playgroud)

当我尝试运行任何dotnet ef命令时出现以下错误:

> dotnet ef database update

Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a …
Run Code Online (Sandbox Code Playgroud)

entity-framework .net-core windows-subsystem-for-linux ef-core-3.0

2
推荐指数
2
解决办法
664
查看次数