typeerror
01/22/2021, 9:02 AMauth/signup route, I always get
{"message": "formFields must be an array"}
I tried something along these lines:
sh
curl -H "Accept: application/json" -X POST -d \{"formFields":"{"id": "email@email.com", "password": "12334"}}" http://localhost:7000/auth/signup -s -S -v -H "Content-Type: application/json"
I also tried other versions, but I can't wrap my head around how to send the POST data via json in the correct format.
Relevant node.js server `index.ts`:
js
/**
* Required External Modules
*/
import express from "express";
import cors from "cors";
import helmet from "helmet";
import supertokens from "supertokens-node";
import EmailPassword from "supertokens-node/recipe/emailpassword";
import Session from "supertokens-node/recipe/session";
import { API_DOMAIN, NODE_PORT, CONNECTION_URI, WEBSITE_DOMAIN } from "./env";
/**
* App Variables
*/
if (!NODE_PORT) {
process.exit(1);
}
const PORT = Number(NODE_PORT);
const app = express();
/**
* App Configuration
*/
supertokens.init({
supertokens: {
connectionURI: CONNECTION_URI,
},
appInfo: {
appName: "Bookclub User Service",
apiDomain: API_DOMAIN,
websiteDomain: WEBSITE_DOMAIN,
},
recipeList: [EmailPassword.init(), Session.init()],
});
app.use(
cors({
origin: WEBSITE_DOMAIN,
allowedHeaders: ["content-type", ...supertokens.getAllCORSHeaders()],
methods: ["GET", "PUT", "POST", "DELETE"],
credentials: true,
})
);
app.use(
helmet({
contentSecurityPolicy: false,
})
);
app.use(supertokens.middleware());
app.use(supertokens.errorHandler());
/**
* Server Activation
*/
app.listen(PORT, () => {
console.log(`Listening on port ${PORT}`);
});
Thank you.