WIP(meteor3): server BOOTS on 3.1 + Mongo 7; restivus async-patched
Major milestone: the Meteor 3.1 server boots and runs against dockerized MongoDB 7, and the REST framework responds (status/uptime OK). - collection2 v4: import its eager entry 'meteor/aldeed:collection2/static.js' from new eager files server|client/00-collection2-init.js so main.js runs and patches attachSchema before collections load (v4 is fully lazy, no main module). - fixtures.js disabled: @cleverbeagle/seeder uses sync Mongo, no Meteor 3 support (dev fixtures, not needed for smoke). Debt. - sitemaps.js disabled: gadicohen:sitemaps@0.0.17 pre-0.9 API, no 'sitemaps' global on Meteor 3. Debt (SEO). - Vendored restivus patched for async endpoints: route handler is async and awaits _callEndpoint; _callEndpoint awaits the action + auth/role checks. NEXT: Rest.js endpoints + helpers (countRealFires/firesUnion/whichAreFalsePositives/ fireFromHash/subscriptionsInsert/upsertFalsePositive) still use sync Mongo (.count()/.findOne()/.fetch()/.insert()/.upsert()) -> convert to *Async, then smoke test against Mongo 7.
This commit is contained in:
parent
25dc1b99c0
commit
b37069c3e5
6 changed files with 30 additions and 8 deletions
|
|
@ -127,7 +127,7 @@ Route = (function() {
|
|||
_.each(allowedMethods, function(method) {
|
||||
var endpoint;
|
||||
endpoint = self.endpoints[method];
|
||||
return JsonRoutes.add(method, fullPath, function(req, res) {
|
||||
return JsonRoutes.add(method, fullPath, async function(req, res) {
|
||||
var doneFunc, endpointContext, error, responseData, responseInitiated;
|
||||
responseInitiated = false;
|
||||
doneFunc = function() {
|
||||
|
|
@ -144,7 +144,8 @@ Route = (function() {
|
|||
_.extend(endpointContext, endpoint);
|
||||
responseData = null;
|
||||
try {
|
||||
responseData = self._callEndpoint(endpointContext, endpoint);
|
||||
// Meteor 3: endpoint actions are async (they use *Async Mongo).
|
||||
responseData = await self._callEndpoint(endpointContext, endpoint);
|
||||
} catch (error1) {
|
||||
error = error1;
|
||||
ironRouterSendErrorToResponse(error, req, res);
|
||||
|
|
@ -250,12 +251,12 @@ Route = (function() {
|
|||
@returns The endpoint response or a 401 if authentication fails
|
||||
*/
|
||||
|
||||
Route.prototype._callEndpoint = function(endpointContext, endpoint) {
|
||||
Route.prototype._callEndpoint = async function(endpointContext, endpoint) {
|
||||
var auth;
|
||||
auth = this._authAccepted(endpointContext, endpoint);
|
||||
auth = await this._authAccepted(endpointContext, endpoint);
|
||||
if (auth.success) {
|
||||
if (this._roleAccepted(endpointContext, endpoint)) {
|
||||
return endpoint.action.call(endpointContext);
|
||||
if (await this._roleAccepted(endpointContext, endpoint)) {
|
||||
return await endpoint.action.call(endpointContext);
|
||||
} else {
|
||||
return {
|
||||
statusCode: 403,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue