DEV Community

Cover image for How to Build a Serverless Web Application

How to Build a Serverless Web Application

Ritik Banger on March 12, 2024

Ah, serverless computing - the buzzword that's been taking the tech world by storm. But what exactly is it, and why should you care? Simply put, se...
Collapse
 
capsule profile image
Thibaut Allender

“and a Lambda function to handle server-side logic”. You mean the serverless-side logic? Oh wait. It’s all cool, hyped and fancy but really you’re just using someone else’s server instead of your own, which has been the case with shared hosting since, well, Geocities.

Collapse
 
ritikbanger profile image
Ritik Banger

Serverless architecture abstracts away server management, allowing developers to focus solely on writing code without worrying about infrastructure. While it utilizes cloud servers, the emphasis is on the "serverless" model, where developers only pay for what they use and scale effortlessly. It does not mean that there is no servers.

Collapse
 
capsule profile image
Thibaut Allender

You didn't get the sarcasm but that's not a reason to ask ChatGPT what serverless really means and paste it here.

Thread Thread
 
ritikbanger profile image
Ritik Banger

LOL. No AI assistance needed for this one. That comment was all human-crafted.

Thread Thread
 
capsule profile image
Thibaut Allender

Sure, if that makes you feel better about using it to write the article…

Thread Thread
 
ritikbanger profile image
Ritik Banger

Dear Thibaut, for the past five years, I've been crafting articles across various websites. If you're unsure about how to write an article, that's perfectly fine – learning is always an option. However, if you suspect this article was generated by AI, feel free to run it through an AI detector and you will know why you need to grow your mindset.

Thread Thread
 
capsule profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
Info Comment hidden by post author - thread only accessible via permalink
Thibaut Allender • Edited

Dude, one year ago you couldn't write a 2 sentences comment without 3 grammar errors and now you're the prodigal son of articles? Give us a break. I don't need an AI detector to do that, my integrated bullshit detector (aka common sense) already went through the roof. i.e. you're telling us the same person wrote dev.to/ritikbanger/how-to-write-gi... and this article? It's insulting to think we're stupid enough to believe so. Bye now.

Collapse
 
610470416 profile image
NotFound404

AWS service is not backed by servers ?
How evil it is to call this serverless.

Collapse
 
ritikbanger profile image
Ritik Banger

Although AWS services are indeed powered by servers, the term "serverless" in this context means developers can build and deploy applications without managing server infrastructure directly. It's a convenience term emphasizing the abstraction of server management tasks, enabling a more streamlined development process.

Collapse
 
ben10 profile image
Ben Honda

Good read. One question I have - what kind of URL is outputted when we deploy the S3 bucket? Is it a “s3.website”-type url, or a special serverless url? The reason I ask is I’m confused how we are able to submit the form to ‘/submit-contact’ and don’t have to use a fully qualified domain or lambda function URL. Thanks for the article

Collapse
 
ritikbanger profile image
Ritik Banger

When you deploy the S3 bucket for your serverless web application, the URL typically takes the form of "bucket-name.s3-website-region.amazonaws.com." This is known as a "static website hosting" URL, specific to S3 hosting.

Regarding submitting the form to '/submit-contact' without using a fully qualified domain or Lambda function URL, in a typical serverless setup with AWS, you would likely employ API Gateway to create a custom RESTful API endpoint like '/submit-contact'. This API Gateway endpoint would be configured to trigger your Lambda function directly. So, although the endpoint appears to be relative, behind the scenes, API Gateway is handling the routing to the appropriate Lambda function.

In the current scenerio, you can see that we have created this endpoint.

functions:
  app:
    handler: handler.handler
    events:
      - http:
          path: submit-contact
          method: post
          cors: true
    environment:
      CONTACTS_TABLE: ${self:service}-contacts-${opt:stage, self:provider.stage}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
c9hp profile image
C9 • Edited

Serverless is just a joke.

Some comments have been hidden by the post's author - find out more