DEV Community

Discussion on: A Discord app with Fastify!

Collapse
 
sachin_ak profile image
Sachin Ananthakumar • Edited

Hi Manuel, I loved reading this blog, I am shifting from express js to fastify and read the docs and gained lots of useful information. one thing which I can't figure out is why do I get the "plugin must be a function or promise" error when I try to run fastify start without deleting the async startApp function where I listen fastify.

I understand in docs for fastify cli there isn't a start function to start the fastify server, because fastify-cli takes care of it. but I don't understand why "plugin must be a function or promise" is caused. can you please explain?

Collapse
 
eomm profile image
Manuel Spigolon

Hi,
fastify-cli will use the exported function to start the bootstrap of the application. Since startApp is not exported, it will complain that it cannot run a file that doesn't export a plugin function or a promise

Collapse
 
sachin_ak profile image
Sachin Ananthakumar

thanks! I got it