mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-03 21:56:36 +00:00
Will be redoing the event interface for subscriptions, some work for the wi and crash fixes
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
var auth = require('../core/jwt_auth.js').auth;
|
||||
|
||||
function RegisterFunction(path, fn, app, api) {
|
||||
app.post(path, auth, function (req, res) {
|
||||
var params = req.body.params || [];
|
||||
|
||||
api.Call(fn, params)
|
||||
.then(function(value) {
|
||||
res.send({ response: value });
|
||||
})
|
||||
.catch(function(reason) {
|
||||
if(reason.message) {
|
||||
res.send({ status: reason.message });
|
||||
}
|
||||
else if(reason === 'Not connected to world server.') {
|
||||
res.send({ status: 'ENCONNECTED' });
|
||||
} else {
|
||||
res.sendStatus(500);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
'Register': RegisterFunction
|
||||
}
|
||||
Reference in New Issue
Block a user