Google只允许通过付款访问其翻译API,但我希望免费访问.
是否可以免费使用Google的翻译API?有哪些替代方案?
我想在vue中部署使用CLI 3.0的app构建.
我的package.json:
"scripts": {
"serve": "vue-cli-service serve",
"postinstall": "npm run build",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e"
}
Run Code Online (Sandbox Code Playgroud)
我添加"@vue/cli": "^3.0.0-rc.3"到devDependencies,但没有看到任何更改.
Azure部署结果:
> npm run vue-cli-service build
npm ERR! missing script: vue-cli-service
Run Code Online (Sandbox Code Playgroud)
你有什么想法?
我创建 POST 端点来创建一个新实体。我还使用字段 userId (将此实体连接到指定用户)和 DTO 创建了 mongoose 模式,我在 POST 方法中使用了 DTO。
@UseGuards(JwtAuthGuard)
@Post("/")
createAction(@Request() req, @Body() createActionDto: CreateActionDto) {
return this.actionService.createAction(req?.user?.userId, createActionDto);
}
Run Code Online (Sandbox Code Playgroud)
数据传输对象:
import { IsString, IsNumber, IsUrl } from 'class-validator';
export class CreateActionDto {
userId: string;
@IsString()
name: string;
@IsNumber()
timeStart: number;
}
Run Code Online (Sandbox Code Playgroud)
架构:
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
@Schema()
export class Action extends Document {
@Prop()
userId: string;
@Prop()
name: string;
@Prop()
timeStart: number;
}
export const …Run Code Online (Sandbox Code Playgroud) 我使用 Nest.js 和 bull 创建了一个应用程序。我添加了bull-board包来监视我的队列,但在文档中,将其添加到应用程序的唯一方法是将其安装为中间件:
在 main.ts 中:
app.use('/admin/queues', bullUI);
Run Code Online (Sandbox Code Playgroud)
在 jwt auth 之后,有什么方法可以在普通的 Nest 控制器中添加 bullUI 吗?喜欢:
@UseGuards(JwtAuthGuard)
@Get("queues")
activate() {
return UI
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试在管道中注入服务。我在控制器 POST 方法中使用管道(signupPipe)。
// signup.pipe.ts
import { PipeTransform, Injectable, BadRequestException } from '@nestjs/common';
import * as bcrypt from 'bcrypt';
import { UserService } from './user.service'
@Injectable()
export class SignupPipe implements PipeTransform<any> {
constructor(private userService: UserService) { }
async transform(value: any) {
// validate password
const areTheSame = this.validatePassword(value.password, value.passwordRepeat);
if (!areTheSame) {
throw new BadRequestException("Password are not the same.");
}
// check if account exists
const isExists = await this.userService.findOne(value.email)
if (isExists) {
throw new BadRequestException("Account with provided …Run Code Online (Sandbox Code Playgroud) 我想创建一个自定义比较器来对列进行升序/降序排序,但在这两种情况下,我想将所有空(空)值保留在列表末尾
我使用 valueGetter 返回正确的字符串值/null。