Modify:
-
Logger
Make it more flexiable, eg: define where the log output!
Add:
SSL
-
command:
$ openssl genrsa -out privatekey.pem 1024 $ openssl req -new -key privatekey.pem -out certrequest.csr $ openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem
-
Add:
- Extend the
config.*.json
to the config Object, the*
is theNODE_ENV
of theprocess.ENV
;- Such as
process.ENV.NODE_ENV === 'DEV'
theconfig.dev.json
file will be loaded and assign to the config object. - The
*
must be lowercase. - The
*
default value isDEV
.
- Such as
Add:
-
Add
disableBodyParser
config.use
new Fpm({ disableBodyParser: ['/notify']})
to disable the/notify
post handleradd a middleware:
app.use(async(ctx, next) => { delete ctx.disableBodyParser; const disableBodyParser = this.get('disableBodyParser'); if(disableBodyParser){ let urls; if(_.isArray(disableBodyParser)){ urls = disableBodyParser; }else if(_.isString(disableBodyParser)){ urls = disableBodyParser.split(','); } const urlPath = ctx.request.url ; _.map(urls, url => { if(_.endsWith(urlPath, url)){ ctx.disableBodyParser = true; } }) } await next() })
-
Support https
Simple Config:
{
ssl: {
key: 'ssl/server.key', // the key filepath
cert: 'ssl/server.crt', // the crt filepath
port: 9443, // the https port
},
}
How to make a ssl key/cert?
Add:
package-lock.json
fpm.getEnv(envKey, defaultValue)
get the process.env key-values
Remove:
- yarn.lock
Add:
-
fpm.getPluginRef(pname)
get the origin ref of the plugin by the plugin name, ex:getPluginRef('mysql')
orgetPluginRef('fpm-plugin-mysql')
-
fpm._webhook_events
record the webhook events contains: { topic!String, message!Object, at!timestamp} -
Use
curl
to perform webhook Webhook Url:/webhook/:upstream/:type/:data
Publish Topic:#webhook/${upstream}/${type}
$ curl -H "Content-Type:application/json" -X POST --data '{"id":10}' http://localhost:9999/webhook/test/foo/bar
BugFix:
publish(topic, data)
Modify:
async execute(method, args, v, ctx)
Thev
Change To Be Optional- add
fpm._publish_topics
, it save all the topics published by the biz functions publish(topic, data)
, It May Throw An Exception When The TOPIC Published By Other Function
BugFix:
- masterkey lost from
before:
let sign = (args) => {
; after:let sign = (args, apps) => {
Add:
-
execShell(shellPath:String!, params:[]?) => Promise
Add an execShell method For Run.sh
or.bat
files.The ShellPath Should Be An Abstract Path BugFix:
-
Digest already called
AT Fileyf-fpm-server/lib/utils/kit.js:25:7
nodejs/node-v0.x-archive#1415
Update:
loadPlugin
- Add Field
package
For Each Plugin, It links this origin reference of the plugin module - Add Field
isBound
For Each Plugin, It means plugin invokebind()
ok
- Add Field
Files:
- Move
loadPlugin
frombin\app.js
toutils\plugin.js
Add 3 Field For Plugin:
- info:
packageInfo
The package.json For The Plugin - npm:
https://www.npmjs.com/package/${packageInfo.name}
The HomePage For The Plugin Innpmjs.com
- registry:
http://registry.npmjs.org/${packageInfo.name}
The Registry Info Of The Plugin
Remove:
- remove
deletedir
Update:
- format all error code & errno
update:
Add:
- default config
server.hostname
&server.domain
server:{ hostname: '0.0.0.0', domain: 'localhost', port: 9999 }
- Return A Promise In
fpm.run()
, it will be called after the server startupapp.run() .then(fpm => { fpm.logger.info('ready ...') })
ADD:
- fpm._counter : count the api calls
- fpm._project_info: the project package.json
Exception Code: from 900
~ 999
Update:
Remove:
- gulp
- jquery
- materialize-css
- log
- moment
- md5
- ncp
- koa-multer
Remove:
- views/
- public/
- admin.js
TODO:
- implement a fpm-plugin-admin
ADD:
- Add Action Before Api Invoke
ctx.fpm.runAction('CALL_API', ctx.fpm, ctx, { method, param, v })
- Attach An Argument
ctx
At Functioncore(method, args, v, fpm, ctx)
- Attach An Argument
ctx
At Each Handlerhandler(args, ctx, [])
- The Last Argument should be replaced by the output of before_*_hook, It always be an Array
- Attach An Argument
ctx
Athook.runHook('before_' + method, args, v, ctx)
TODO:
- Add Ip Filter In File
permission.js
ss
Remove
-
The
BEFORE_MODULES_ADDED
&AFTER_MODULES_ADDED
Action Hook Points May Invoke Multi Times;fpm.addBizModules(biz:Biz)
can be called many times -
In The Middleware
response.js
; Support More Type Of Result Not OnlyObject
ctx.success = (result, msg) => { data.message = msg || '' if(_.isPlainObject(result)){ if(_.has(result, data)){ data.data = result.data return } } data.data = result }
Add
extendModule(name:String!, module:Object/Function!, version:String?)
for plugin inDEV
modegetPlugins()
show all loaded pluginsisPluginInstalled(name:String!)
Remove
- example\runner.js
Add
- Fpm
- Admin
- login
- Admin
Add
- Fpm
createRouter
bindRouter(router)
Remove
- upload router
- upload dir
- remove
qiniu
dep
Plugin
- qiniu upload plugin
- memory upload plugin
Feature
- Support file middleware
qiniu
Feature
- Support upload use
koa-multer
Feature
- upload
Feature
- Support Pub/Sub
Remove
- concat analyse.js to auth.js
Change
- Use
Reg.test()
To Validate The App Root
Feature
- plugin inject config to FPM.config
extendConfig(c){
config = _.assign(config, c || {})
}
Remove
- util.job,util.logger
Files Change
- Add example dir with app.js
- check config.json when FPM.INIT()
BreakChange:
- cancel config middleware
Feature:
-
Support Plugin
-
update koa2-cors modules
-
Add getConfig() from config.json static config file
-
add more hook points [ INIT, BEFORE_ROUTER_ADDED, AFTER_ROUTER_ADDED, BEFORE_MODULES_ADDED, AFTER_MODULES_ADDED, BEFORE_SERVER_START, AFTER_SERVER_START]
-
add execute method for fpm class
Feature:
- support post json data
- update Koa Modules
FixBugs:
- server error TypeError: args.hasOwnProperty is not a function
server error TypeError: args.hasOwnProperty is not a function
at checkArgs (F:/FPM/yf-fpm-server/src/middleware/compare.js:55:16)
at compare (F:/FPM/yf-fpm-server/src/middleware/compare.js:9:21)
at _callee$ (F:/FPM/yf-fpm-server/src/middleware/compare.js:107:23)
at tryCatch (F:\FPM\yf-fpm-server\node_modules\.0.10.1@regenerator-runtime\runtime.js:64:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (F:\FPM\yf-fpm-server\node_modules\.0.10.1@regenerator-runtime\runtime.js:355:22)
Bug: /src/middleware/compare.js:55:16
before:
if(!args.hasOwnProperty(a))
after:
if(!_.has(args, a))