mirror of
https://github.com/Unitech/pm2.git
synced 2025-12-08 20:35:53 +00:00
(example) more meaningful custom actions
This commit is contained in:
parent
bcb737281a
commit
2379d00d85
@ -1,33 +1,18 @@
|
||||
|
||||
var axm = require('pmx');
|
||||
|
||||
axm.action('getEnv', function(reply) {
|
||||
reply(process.env);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
axm.action('refresh:db2', {comment : 'Refresh main database'}, function(reply) {
|
||||
|
||||
axm.emit('user:register', {
|
||||
user : 'Alex registered',
|
||||
email : 'thorustor@gmail.com'
|
||||
axm.action('sayHello', function(reply) {
|
||||
reply({
|
||||
msg : 'Yes hello and so? Xie Xie'
|
||||
});
|
||||
|
||||
reply({success : true});
|
||||
});
|
||||
|
||||
|
||||
|
||||
axm.action('hello', {comment : 'Refresh main database'}, function(reply) {
|
||||
console.log('Refreshing');
|
||||
reply({success : true});
|
||||
});
|
||||
|
||||
axm.action('refresh:db3', {comment : 'Comment'}, function(reply) {
|
||||
axm.action('throwError', function(reply) {
|
||||
//@todo : replying a error does not work
|
||||
reply(new Error('Error thrown'));
|
||||
throw new Error('asdadsadsasd');
|
||||
reply({success : false});
|
||||
});
|
||||
|
||||
axm.action('refresh:db', {comment : 'Refresh main database'}, function(reply) {
|
||||
console.log('Refreshing');
|
||||
reply({success : true});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user