koa2项目新看法 绝对正确的最佳路径
1、
"scripts": {
"dev": "ts-node-dev --respawn --transpile-only src/index.ts",
"build": "tsc -p tsconfig.json",
"start": "node dist/index.js"
},
2、关于koa适配typeorm的情况
import { DataSource } from "typeorm";
import "dotenv/config";
import * as path from "path";
const entityExtension = __filename.endsWith(".ts") ? "ts" : "js";
export const PGsqlDataSource = new DataSource({
type: "postgres",
host: process.env.PGSQL_HOST,
port: Number(process.env.PGSQL_PORT),
username: process.env.PGSQL_USERNAME,
password: process.env.PGSQL_PASSWORD,
database: process.env.PGSQL_DATABASE,
synchronize: false,
entities: [path.join(__dirname, `../pgsqlentity/*.${entityExtension}`)],
logging: true,
});
漫思
浙公网安备 33010602011771号