kreteshq / kretes

A Programming Environment for TypeScript & Deno
https://kretes.dev/
Other
676 stars 35 forks source link

Error after create controller #90

Closed zeny closed 4 years ago

zeny commented 4 years ago

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)

zaiste commented 4 years ago

@zeny could you paste your controller code ?

zeny commented 4 years ago

@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;
zaiste commented 4 years ago

@zeny it looks like you made a typo in the filename. Could you double check your file name is create.ts ?

zeny commented 4 years ago

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

zeny commented 4 years ago

Hello @zaiste issue solved after remove 'Event' folder from /dist/features then rerun the application again.

Thanks for this nice solution

zaiste commented 4 years ago

@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.

emilos commented 4 years ago

@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