Prince Wilson: 0:00 To get started, we're going to build a netlify.toml file. Inside of here, we're going to declare, during the build phase, their functions are located in the functions directory.
0:12 Currently, we don't have that existing, so let's make sure we're going to add that. We want this at the top most level. Let's add a folder called functions. Inside of that folder, we're going to declare a file called hello.js.
0:25 In this file, we must have exports.handler equal to async function with two parameters -- event and context. We won't be using this in this video, but it's important to know that they are there.
0:36 This function needs to return a json object with a key of statusCode declaring, "Hey, everything is OK," so 200. The key body, the body of the response, so in our case, "Hello, World." Congratulations, you made a Netlify function.
0:52 Go into your terminal. Write the command, netlify dev. This will run the application as well as get everything set up for Netlify. In another terminal session, make sure to run the command, netlify functions:invoke. This will invoke our function locally. Inside of the terminal, you should see the output, "Hello, World."
1:15 To recap, we started by creating a netlify.toml file where we defined where Netlify should build a function. We went ahead and build our first function inside up here returning the body, "Hello, World."
1:27 We went inside of our terminal and wrote the command, netlify dev. We see the application has started our local dev server. We opened another terminal session, wrote netlify functions:invoke and saw the output of our function, "Hello, World."