init project

This commit is contained in:
illuz committed 2022-07-05 14:40:21 +08:00
commit 571ba2a8a1
34 files changed
+3618

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
'use strict';
const path = require('path');
const assert = require('assert');
const { middleware, middlewareMatch } = require('egg-jianghu/config/middlewareConfig');
const eggJianghuPathTemp = require.resolve('egg-jianghu');
const eggJianghuPath = path.join(eggJianghuPathTemp, '../');
module.exports = appInfo => {
assert(appInfo);
const appId = 'xianfeng-v1';
const uploadDir = path.join(appInfo.baseDir, 'upload');
const downloadBasePath = `/${appId}/upload`;
return {
appId,
appTitle: '先锋v1',
appLogo: `${appId}/public/img/logo.png`,
appType: 'single',
appDirectoryLink: '/',
indexPage: `/${appId}/page/manual`,
loginPage: `/${appId}/page/login`,
helpPage: `/${appId}/page/help`,
uploadDir,
downloadBasePath,
static: {
maxAge: 0,
buffer: false,
preload: false,
maxFiles: 0,
dir: [
{ prefix: `/${appId}/public/`, dir: path.join(appInfo.baseDir, 'app/public') },
{ prefix: `/${appId}/public/`, dir: path.join(eggJianghuPath, 'app/public') },
{ prefix: `/${appId}/upload/`, dir: uploadDir },
],
},
view: {
defaultViewEngine: 'nunjucks',
mapping: { '.html': 'nunjucks' },
root: [
path.join(appInfo.baseDir, 'app/view'),
path.join(eggJianghuPath, 'app/view'),
].join(','),
},
middleware,
...middlewareMatch,
};
};
+40
View File
@@ -0,0 +1,40 @@
'use strict';
const path = require('path');
module.exports = appInfo => {
return {
static: {
maxAge: 0,
buffer: false,
preload: false,
maxFiles: 0,
},
logger: {
outputJSON: true,
consoleLevel: 'DEBUG',
level: 'DEBUG',
dir: path.join(appInfo.baseDir, 'logs'),
contextFormatter(meta) {
return `[${meta.date}] [${meta.level}] [${meta.ctx.method} ${meta.ctx.url}] ${meta.message}`;
}
},
knex: {
client: {
dialect: 'mysql',
connection: {
host: '127.0.0.1',
port: 3306,
user: 'root',
password: '123456',
database: 'xianfeng-v1'
},
pool: { min: 0, max: 30 },
acquireConnectionTimeout: 30000
},
app: true
}
};
};
+40
View File
@@ -0,0 +1,40 @@
'use strict';
const path = require('path');
module.exports = appInfo => {
return {
static: {
maxAge: 0,
buffer: false,
preload: false,
maxFiles: 0,
},
logger: {
outputJSON: true,
level: 'INFO',
// level: 'DEBUG',
// allowDebugAtProd: true,
dir: path.join(appInfo.baseDir, 'logs'),
contextFormatter(meta) {
return `[${meta.date}] [${meta.level}] [${meta.ctx.method} ${meta.ctx.url}] ${meta.message}`;
}
},
knex: {
client: {
dialect: 'mysql',
connection: {
host: '127.0.0.1',
port: '3306',
user: 'root',
password: '123456',
database: 'xianfeng-v1'
},
pool: { min: 0, max: 30 },
acquireConnectionTimeout: 30000
},
app: true
}
};
};
+23
View File
@@ -0,0 +1,23 @@
'use strict';
module.exports = appInfo => {
return {
knex: {
client: {
dialect: 'mysql',
connection: {
host: '127.0.0.1',
port: '3306',
user: 'root',
password: '123456',
database: 'xianfeng-v1'
},
pool: { min: 0, max: 30 },
acquireConnectionTimeout: 30000,
},
app: true,
},
};
};
+5
View File
@@ -0,0 +1,5 @@
'use strict';
/** @type Egg.EggPlugin */
module.exports = {
};