feat: add backend-mock app

This commit is contained in:
vben
2024-06-30 14:09:44 +08:00
parent c58aa26dbf
commit ca1cad0cd3
71 changed files with 3420 additions and 735 deletions

View File

@@ -0,0 +1,8 @@
NODE_ENV: development
port: 5320
apiPrefix: /api
jwt:
secret: plonmGN4aSuMVnucrHuhnUoo49Wy
expiresIn: 1d
refreshSecret: 1lonmGN4aSuMVnucrHuhnUoo49Wy
refreshexpiresIn: 7d

View File

@@ -0,0 +1,23 @@
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import process from 'node:process';
import * as yaml from 'js-yaml';
const configFileNameObj = {
development: 'dev',
production: 'prod',
};
const env = process.env.NODE_ENV;
const configFactory = () => {
return yaml.load(
readFileSync(
join(process.cwd(), 'src', 'config', `${configFileNameObj[env]}.yml`),
'utf8',
),
) as Record<string, any>;
};
export default configFactory;

View File

@@ -0,0 +1,8 @@
NODE_ENV: production
port: 5320
apiPrefix: /api
jwt:
secret: plonmGN4SuMVnucrHunUoo49Wy12
expiresIn: 1d
refreshSecret: 2lonmGN4aSuMVnucrHuhnUoo49Wy
refreshexpiresIn: 7d