DEV Community

Discussion on: How do You Structure Your Code When Moving Your API from Express to Serverless Functions?

Collapse
 
jon64digital profile image
jon64digital

Yes, please post more on this topic. I'm just learning to create my first node APIs using Express. Do you think I should try using Express with Azure functions or just ditch Express and go with a bare bones approach. It could end up being a fairly big API.

Collapse
 
john_papa profile image
John Papa

Node and express are a fantastic and proven combination for apis. And it can do so much more. Serverless is a choice that helps scale up and down without the need for much server config

I would still lean on both as they are both excellent options.

If you need help designing an api with serverless I know the azure functions team is always very helpful with this as they help a lot of companies be successful.

Collapse
 
juanitomint profile image
Juan Ignacio Borda

My 2cents on this, before code make the definition document with swagger editor (now open API) if you don't know learn this first as it will make your API more portable, then code it on express directly, once is up and running you can stay a migration to serverless endpoint by endpoint

Pd swagger editor can create servers and clients from a definition file automatically

Collapse
 
_mhoeger profile image
Marie H

+1 to Jaun's suggestion about starting with the definition document!!

To your question about starting with express and migrating vs. starting bare bones - I think it depends on your needs. Express has extensive middleware that can be very useful. Azure Functions has built-in functionality like proxies, easy integration to other services with triggers and bindings, and immediate deploy to prod. To echo John, both are great options.

As an aside, although this isn't an official package, you may be interested in checking out azure-functions-express on npm too!

Collapse
 
jon64digital profile image
jon64digital

Thanks everyone. I saw azure-functions-express but wasn't sure whether to go down that route or whether that was trying to crow bar something inappropriate into functions.