lshbosheth 最近的时间轴更新
lshbosheth

lshbosheth

V2EX 第 670811 号会员,加入于 2024-01-11 10:09:07 +08:00
lshbosheth 最近回复了
口头语? 那我口头语 你他妈 那可咋办呦 (开玩笑)
@2020583117 我也是初学者 按照我之前 angular 经验和 chatgpt 搞得 。。。
@star505 几年前得有三年了把 讯飞贼爽 后来就不行了 感觉 不智能了 就全用默认输入法了 微软 or apple
@2020583117 {
"builds": [
{
"src": "src/main.ts",
"use": "@vercel/node"
}
],
"routes": [
{ "src": "/(.*)", "dest": "src/main.ts" }
]
}
就这一点 我感觉这个就是个纯入口文件的作用把 和数据库没关系
这是我 ormconfig 配置
import { TypeOrmModuleOptions } from '@nestjs/typeorm';

const VercelConfig: TypeOrmModuleOptions = {
type: 'postgres',
host: 'ep-aged-waterfall-13013279-pooler.us-east-1.postgres.vercel-storage.com',
port: 5432,
username: 'xxx',
password: 'xxx',
database: 'xxx',
ssl: { rejectUnauthorized: false }, // For local development, consider removing this in production
synchronize: true, // Automatically create database tables based on entities (set to false in production)
logging: process.env.NODE_ENV === 'development' ? true : ['error'],
entities: [__dirname + '/**/*.entity{.ts,.js}'],
};

const MySqlLocalConfig: TypeOrmModuleOptions = {
type: 'mysql',
host: 'xxx',
port: 3306,
username: 'root',
password: 'xxx',
database: 'xxx',
synchronize: true,
retryDelay: 500,
retryAttempts: 10,
autoLoadEntities: true,
logging: process.env.NODE_ENV === 'development' ? true : ['error'],
};

export { VercelConfig, MySqlLocalConfig };
具体我也不懂 哈哈哈
直接 app.module 就用了 TypeOrmModule.forRoot(MySqlLocalConfig)
然后 再 service 里直接整就完事了
@2020583117 我感觉和这个配置没关系把 这个无非也就是类似入口文件的 作用 ?
我连我服务器的 mysql 还是 vercel 的 pq 数据库 都可以,,,
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1895 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 15ms · UTC 01:22 · PVG 09:22 · LAX 18:22 · JFK 21:22
Developed with CodeLauncher
♥ Do have faith in what you're doing.