Serverless Functions in JavaScript | Build Netlify Serverless Functions with JavaScript

Sdílet
Vložit
  • čas přidán 6. 07. 2024
  • Web Dev Roadmap for Beginners (Free!): bit.ly/DaveGrayWebDevRoadmap
    Build Serverless Functions in JavaScript with this Netlify Serverless Functions tutorial. Serverless Functions can be written in JavaScript and set up for deployment with GitHub and Netlify.
    Subscribe ➜ bit.ly/3nGHmNn
    🔗 Source Code: github.com/gitdagray/serverless
    (0:00) Intro
    (1:35) Structure HTML
    (3:19) Add CSS
    (7:26) Add JavaScript
    (11:09) Add a CSS Animation
    (12:53) JS Fetch with Async / Await
    (14:23) Quick Refactor
    (15:10) Create a git repo and push to GitHub
    (17:05) Link your project to Netlify with Continuous Deployment
    (18:05) Install NodeJS
    (18:25) Install Netlify CLI
    (19:48) Initialize npm
    (20:14) Create a .gitignore file
    (20:38) Install node-fetch package dependency
    (21:11) Create the serverless functions folder
    (21:22) Create a serverless function
    (23:48) Modify the fetch function in our main.js
    (24:35) Use Netlify CLI to test our serverless function
    (25:11) A more practical serverless example
    (27:27) Where to add environment variables in Netlify
    ✅ Follow Me:
    Twitter: / yesdavidgray
    LinkedIn: / davidagray
    Blog: yesdavidgray.com
    Reddit: / daveoneleven
    Was this tutorial about how to build Serverless Functions with JavaScript helpful? If so, please share. Let me know your thoughts in the comments.
    #serverless #functions #javascript
  • Věda a technologie

Komentáře • 30

  • @DaveGrayTeachesCode
    @DaveGrayTeachesCode  Před 3 lety +2

    This tutorial shows you how to set up serverless functions with Netlify. Netlify makes AWS serverless lambda functions easy. I show you how to set up an API relay that can hide your API keys from your frontend code, but you can do much more with serverless because it is like having a NodeJS server to run code on! If you are interested in another way to hide API keys, check out my NodeJS API Relay tutorial: czcams.com/video/uk9pviyvrtg/video.html

  • @marie-elizeventer7080
    @marie-elizeventer7080 Před rokem +1

    This was GREAT! I have been watching tutorials for a week now to get data from an API, and here you explained it so plainly! Thanks!

  • @ahmad-murery
    @ahmad-murery Před 3 lety +4

    I didn't get the idea behind the serverless before since we still need to create server functions and I didn't find anyone do it the way you did by creating it locally then convert it to a nodejs and finally upload it to a serverless server
    Thanks and I hope you can make a dedicated series on serverless functions

  • @andrewclarke6916
    @andrewclarke6916 Před 3 lety +2

    Brad Traversy sent me here, Dave. I enjoyed learning about using serverless functions which are new to me. Looking forward to seeing project based tutorials from you in the future.

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  Před 3 lety

      Thanks to Brad and thank you for watching and subscribing. Working on a project right now!

  • @hellelo.5840
    @hellelo.5840 Před 2 lety +1

    this was a smooth tutorial, that rock hair suits you, You are a rock Star

  • @CynthiaSotoCaballerolYEAHl

    Soooooo greeeatttt tutorial for understanding the serverless thing

  • @rangabharath4253
    @rangabharath4253 Před 3 lety +1

    awesome as always Dave. Thank u so much :-)

  • @kewltopix
    @kewltopix Před 3 lety +2

    Hope all is getting better Dave... awesome and timely content as always!!

  • @tunzdev
    @tunzdev Před 3 lety

    Thanks for this!

  • @marie-elizeventer7080

    Thanks!

  • @saadowain3511
    @saadowain3511 Před 2 lety +1

    Amazing

  • @zakhariihusar6975
    @zakhariihusar6975 Před 3 lety +2

    I started to learn JS recently. Made a small website in 3 languages(English, Italian, Ukrainian) on netlify, but the problem is that I duplicated pages for every language, was looking for a solution, for example to keep translation in JSON. But I see to use serverless functions I need to know backend as well?

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  Před 3 lety +2

      Yes, "serverless" refers to not needing to maintain a server, but it actually still runs code on a server in the cloud. Serverless functions are great for this because instead of developing a complete backend API, you just build the limited functionality you need. The backend code is Node JS though, so after you are comfortable with Javascript, it is not difficult to pick up. 😀

    • @zakhariihusar6975
      @zakhariihusar6975 Před 3 lety +1

      @@DaveGrayTeachesCode thank you a lot, now I'm not so confused about it👍

  • @stepanmutsikivsky8987
    @stepanmutsikivsky8987 Před 9 měsíci

    On my lubuntu: sudo npm i netlify-cli -g