Closed zeny closed 4 years ago
@zeny could you paste your controller code ?
@zaiste This my code
import {Created} from "huncwot/response"; import EventRepository from "../Repository"; import { Handler } from "huncwot";
const create: Handler = ({params}) =>{ const {name, location} = params; const event = EventRepository.create(name,location);
return Created(event);
}
export = create;
@zeny it looks like you made a typo in the filename. Could you double check your file name is create.ts
?
I was created but with Capital C "Create.ts", I have changed it to "create.ts" no issue occurs.
and I have HTTP/1.1 404 Not Found after call API
Hello @zaiste issue solved after remove 'Event' folder from /dist/features then rerun the application again.
Thanks for this nice solution
@zeny I'm glad it helped! Please let me know if you had other issues along the way. There are still rough edges in this project.
@zaiste I think error handling could be improved based on this, e.g. the user could be notified in the console that he has created a file with an incorrect name
TypeError: Cannot destructure property 'method' of 'translate(...)' as it is undefined. at new Huncwot (/usr/lib/node_modules/huncwot/index.js:111:17) at start (/usr/lib/node_modules/huncwot/cli/server.js:53:15) at /usr/lib/node_modules/huncwot/cli/server.js:119:17 at processTicksAndRejections (internal/process/task_queues.js:97:5) at async Promise.all (index 0)