I had the same problem too. This works for me:
const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('api::post.post', ({ strapi }) => ({
async create(ctx) {
... your code ...
}
async update(ctx) {
... your code ...
}
}))