remult 0.14.16 → 0.14.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/remult-middleware.js
CHANGED
|
@@ -38,7 +38,10 @@ class middleware {
|
|
|
38
38
|
return route;
|
|
39
39
|
}
|
|
40
40
|
handleRequest(req, res, next) {
|
|
41
|
-
|
|
41
|
+
let theUrl = req.url;
|
|
42
|
+
if (theUrl.startsWith('/')) //next sends a partial url '/api/tasks' and not the full url
|
|
43
|
+
theUrl = 'http://stam' + theUrl;
|
|
44
|
+
const url = new URL(theUrl);
|
|
42
45
|
const path = url.pathname;
|
|
43
46
|
if (!req.query) {
|
|
44
47
|
let query = {};
|
|
@@ -72,6 +75,8 @@ class middleware {
|
|
|
72
75
|
if (m) {
|
|
73
76
|
let h = m.get(req.method.toLowerCase());
|
|
74
77
|
if (h) {
|
|
78
|
+
if (!req.params)
|
|
79
|
+
req.params = {};
|
|
75
80
|
req.params.id = path.substring(idPosition + 1);
|
|
76
81
|
h(req, res, next);
|
|
77
82
|
return;
|
|
@@ -3,7 +3,7 @@ import axios from 'axios';
|
|
|
3
3
|
import { HttpProviderBridgeToRestDataProviderHttpProvider, Remult } from '../context';
|
|
4
4
|
import { Entity, Fields } from '../remult3';
|
|
5
5
|
import { Action, BackendMethod } from '../server-action';
|
|
6
|
-
Remult.apiBaseUrl = 'http://localhost:
|
|
6
|
+
Remult.apiBaseUrl = 'http://localhost:8000/api';
|
|
7
7
|
const path = Remult.apiBaseUrl + '/tasks';
|
|
8
8
|
fit("works", async () => {
|
|
9
9
|
const repo = await create3Tasks();
|
package/package.json
CHANGED
package/remult-middleware.js
CHANGED
|
@@ -42,7 +42,10 @@ var middleware = /** @class */ (function () {
|
|
|
42
42
|
return route;
|
|
43
43
|
};
|
|
44
44
|
middleware.prototype.handleRequest = function (req, res, next) {
|
|
45
|
-
var
|
|
45
|
+
var theUrl = req.url;
|
|
46
|
+
if (theUrl.startsWith('/')) //next sends a partial url '/api/tasks' and not the full url
|
|
47
|
+
theUrl = 'http://stam' + theUrl;
|
|
48
|
+
var url = new URL(theUrl);
|
|
46
49
|
var path = url.pathname;
|
|
47
50
|
if (!req.query) {
|
|
48
51
|
var query_1 = {};
|
|
@@ -76,6 +79,8 @@ var middleware = /** @class */ (function () {
|
|
|
76
79
|
if (m) {
|
|
77
80
|
var h = m.get(req.method.toLowerCase());
|
|
78
81
|
if (h) {
|
|
82
|
+
if (!req.params)
|
|
83
|
+
req.params = {};
|
|
79
84
|
req.params.id = path.substring(idPosition + 1);
|
|
80
85
|
h(req, res, next);
|
|
81
86
|
return;
|
|
@@ -6,7 +6,7 @@ var axios_1 = require("axios");
|
|
|
6
6
|
var context_1 = require("../context");
|
|
7
7
|
var remult3_1 = require("../remult3");
|
|
8
8
|
var server_action_1 = require("../server-action");
|
|
9
|
-
context_1.Remult.apiBaseUrl = 'http://localhost:
|
|
9
|
+
context_1.Remult.apiBaseUrl = 'http://localhost:8000/api';
|
|
10
10
|
var path = context_1.Remult.apiBaseUrl + '/tasks';
|
|
11
11
|
fit("works", function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
12
12
|
var repo, tasks, _a;
|