优化项目结构,优化构建脚本,优化README.MD
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Qumolama.d
2022-05-04 21:04:44 +08:00
parent 99d304899d
commit bd8b866f07
6 changed files with 113 additions and 69 deletions

View File

@ -1,23 +1,38 @@
const defaultPrehandler = async function (req, rep) { }
export const config = {
database: {
database: { // MONGODB IS THE BEST DATABASE
url: 'mongodb://localhost:27017/yggdrasil?readPreference=primary&appname=MongoDB%20Compass&directConnection=true&ssl=false',
},
server: {
port: 3000,
url: '',
port: 3000
},
signing: {
signing: { // 签名材质信息使用
public: '/path/to/public.pem',
private: '/path/to/private.key'
},
custom: {
overridePrehandler: (url) => {
return defaultPrehandler
override: {
preHandler: {
/*
"/example/route": async function(req, rep) {}
*/
},
handler: {
/*
"/example/route": async function(req, rep) {}
*/
}
},
preHooks: (fastify) => {},
preRouting: (fastify) => {},
postRouting: (fastify) => {},
preHooks: (fastify) => {}, // 在这里添加自定义hook
preRouting: (fastify) => {}, // 在这里添加自定义路由
postRouting: (fastify) => {}, // IDK what u want to do at here
}
}
export function getOverrideHandler(route) {
return config.custom.override.handler[route]
}
export function getOverridePreHandler(route) {
return config.custom.override.preHandler[route]
}