eddev 0.2.0-beta.26 → 0.2.0-beta.29
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.
|
@@ -182,9 +182,13 @@ function createNextApp(opts) {
|
|
|
182
182
|
// Write APIs proxy code
|
|
183
183
|
_b.sent();
|
|
184
184
|
// Remove pages/api/trpc directory if no _rpc is found
|
|
185
|
+
console.log({
|
|
186
|
+
index: (0, path_1.join)(opts.baseDirectory, "api/_rpc/index.ts"),
|
|
187
|
+
rpc: (0, path_1.join)(opts.baseDirectory, "api/_rpc.ts"),
|
|
188
|
+
});
|
|
185
189
|
if (!(0, fs_1.existsSync)((0, path_1.join)(opts.baseDirectory, "api/_rpc/index.ts")) &&
|
|
186
190
|
!(0, fs_1.existsSync)((0, path_1.join)(opts.baseDirectory, "api/_rpc.ts"))) {
|
|
187
|
-
|
|
191
|
+
// removeSync(join(serverlessDirectory, "pages/api/trpc"))
|
|
188
192
|
}
|
|
189
193
|
_b.label = 17;
|
|
190
194
|
case 17:
|
package/package.json
CHANGED
|
@@ -12,15 +12,18 @@ export default function (req: NextApiRequest, res: NextApiResponse) {
|
|
|
12
12
|
// TODO: Use an origin whitelist
|
|
13
13
|
const origin = req.headers.origin
|
|
14
14
|
if (origin) {
|
|
15
|
-
res.setHeader("Access-Control-Allow-Origin", "*")
|
|
16
|
-
res.setHeader("Access-Control-Request-Method", "*")
|
|
17
|
-
res.setHeader("Access-Control-Request-Method", "OPTIONS, GET, POST")
|
|
18
|
-
res.setHeader("Access-Control-Allow-Headers", "*")
|
|
19
15
|
if (req.method === "OPTIONS") {
|
|
16
|
+
res.setHeader("Access-Control-Allow-Origin", "*")
|
|
17
|
+
res.setHeader("Access-Control-Request-Method", "*")
|
|
18
|
+
res.setHeader("Access-Control-Request-Method", "OPTIONS, GET, POST")
|
|
19
|
+
res.setHeader("Access-Control-Allow-Headers", "*")
|
|
20
20
|
res.writeHead(200)
|
|
21
21
|
res.end()
|
|
22
22
|
return
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
// res.writeHead(200)
|
|
26
|
+
res.json("Test")
|
|
27
|
+
return
|
|
28
|
+
// return handler(req, res)
|
|
26
29
|
}
|