Throughout December we'll be highlighting a different Netlify feature each day. It might just be the thing you need to unlock those creative juices, and dust off that domain you registered but never deployed! Keep an eye on the blog and on Twitter for each feature!
Once upon a time, if you needed a back-end for your web project you'd have to get yourself a server. Or perhaps a virtual server. Either way, you were in for some configuration and maintenance. Maintenance which would last forever.
But building, deploying, and versioning serverless functions can be tricky, right? No, not these days. We got you!
Netlify Functions adds an entire serverless development and deployment pipeline to your project as part of your existing workflow.
All you need to do is add a file containing your functions to a
netlify/functions folder in your project directory, and push them to your project repo. That's it.
When you do that, your functions (and any dependencies) will be packaged up, deployed to AWS Lambda, and all of their configuration will be taken care of, resulting in serverless functions with URLs relative to your project's root. No need for an AWS account. No need to leave your code.
How you name your function files determines the URL that they get.
By default, a file called
random-joke.js will be served up at the URL
But you can configure this in order to have complete control over your URL design.
Deploying updates and rolling back to previous versions of your serverless functions happens just the same as with the rest of your code. They are part of the same codebase and benefit from all of the same workflow tools as the rest of your site.
Here's a simple example site to explore. You can make a copy and deploy it to Netlify with just a couple of clicks. Try it out by clicking the Deploy to Netlify button below.