System Information
Strapi Version : 4.10.5
Operating System : Windows 10
Database : better-sqlite3 ???
Node Version : v16.18.1
Yarn Version : 1.22.19
I want to make a dating site for men and women. I have created 2 different collections in Strapi, one for men, another for women because they have different required fields at registration and further. How do i send data to Woman/Man collection type and to User at the same time?
In your middleware, on registration, you can intercept the request and populate your collections using the entity service.
Please be more specific. There is so much information on different middlewares. In what folder do i create which file (name of the file)?
I cannot be more specific as you’ve provided no code. We can’t just provide solutions to high-level concepts.
I recommend you read the docs
export default async (req, res) => {
const { password, email, name } = req.body
try {
const response = await axios.post(
`${process.env.NEXT_PUBLIC_API_URL}/api/auth/local/register`,
{
username: email,
email,
password,
name,
}
)
setCookie({ res }, 'jwt', response.data.jwt, {
httpOnly: true,
secure: process.env.NODE_ENV !== 'development',
maxAge: 30 * 24 * 60 * 60,
path: '/',
})
res.status(200).end()
} catch (e) {
res.status(400).send(e.response.data.error.details.errors[0].message)
}
}
Could not understand what to write where.
This does not help. No such directories
This does not work with User collection type(
Visually design your custom API's (or custom reports / or custom views) directly from the Strapi CMS admin panel. Simply select the fields you need to show, enter a valid slug and let the plugin magically create the routes, controllers & services...