-
Notifications
You must be signed in to change notification settings - Fork 20
Closed
Description
I am getting error with my page
./pages/api/[...all].ts:13:10
Type error: This expression is not callable.
Type 'typeof import("/Users/joeyoung/_WORKING/joegyoung/node_modules/next-http-proxy-middleware/src/index")' has no call signatures.
11 | } = req;
12 |
> 13 | return httpProxyMiddleware(req, res, {
| ^
14 | // You can use the `http-proxy` option
15 | target: `http://localhost:9000/.netlify/functions/${all}`,
16 | pathRewrite: {
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
This is the source
import { NextApiRequest, NextApiResponse } from "next";
import httpProxyMiddleware from "next-http-proxy-middleware";
const isDevelopment = process.env.NODE_ENV === "development";
const isProduction = process.env.NODE_ENV === "production";
export default (req: NextApiRequest, res: NextApiResponse) => {
if (isDevelopment) {
const {
query: { all },
} = req;
return httpProxyMiddleware(req, res, {
// You can use the `http-proxy` option
target: `http://localhost:9000/.netlify/functions/${all}`,
pathRewrite: {
"^/api+": "",
},
});
} else {
res.status(404).send(null);
}
};
What am I needing to do?
JulienDemarque and stegano
Metadata
Metadata
Assignees
Labels
No labels