Uptime in status api
This commit is contained in:
parent
2d0c8f664b
commit
984ce8531d
1 changed files with 9 additions and 0 deletions
|
|
@ -7,6 +7,8 @@ import SiteSettings from '/imports/api/SiteSettings/SiteSettings';
|
||||||
import ActiveFiresCollection from '/imports/api/ActiveFires/ActiveFires';
|
import ActiveFiresCollection from '/imports/api/ActiveFires/ActiveFires';
|
||||||
|
|
||||||
Meteor.startup(() => {
|
Meteor.startup(() => {
|
||||||
|
const uptime = new Date();
|
||||||
|
|
||||||
const apiV1 = new Restivus({
|
const apiV1 = new Restivus({
|
||||||
useDefaultAuth: true,
|
useDefaultAuth: true,
|
||||||
apiPath: 'api',
|
apiPath: 'api',
|
||||||
|
|
@ -66,4 +68,11 @@ Meteor.startup(() => {
|
||||||
return { total: ActiveFiresCollection.find({}).count() };
|
return { total: ActiveFiresCollection.find({}).count() };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Maps to: /api/v1/status/uptime
|
||||||
|
apiV1.addRoute('status/uptime', { authRequired: false }, {
|
||||||
|
get: function get() {
|
||||||
|
return { ms: new Date() - uptime };
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue