routing-controllers
routing-controllers copied to clipboard
@BodyParam doesn't work without explicitly using the 'body-parser' module
I have to use this:
const app = express();
app.use(bodyParser.urlencoded());
useExpressServer(app, {
controllers: [
...
],
cors: true,
});
instead of this:
createExpressServer(app, {
controllers: [
...
],
cors: true,
});
The controller and action:
@Service()
@JsonController('/auth')
export class AuthController {
constructor(
@InjectRepository(User)
private userRepository: Repository<User>,
) {
}
@Post('/form/register')
public async register(
@BodyParam('email') email: string,
@BodyParam('password') password: string,
): Promise<User> {
...
}
}
Dammmn. This is depressing. I've been stuck with this problem for a few hours. Thank you so much!
Stale issue message
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.