{"id":15645709,"url":"https://github.com/xlanex6/netlify_first_lambda","last_synced_at":"2025-03-29T23:14:26.315Z","repository":{"id":126026329,"uuid":"162853304","full_name":"xlanex6/netlify_first_lambda","owner":"xlanex6","description":"101 netlify lambda - functions as service - Serverless","archived":false,"fork":false,"pushed_at":"2023-06-29T18:44:18.000Z","size":327,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-05T00:38:53.034Z","etag":null,"topics":["javascript","netlify-functions","serverless"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xlanex6.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-23T01:12:34.000Z","updated_at":"2023-08-18T17:02:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"9f9d9caf-5eaf-49b4-a24b-89c117feb48d","html_url":"https://github.com/xlanex6/netlify_first_lambda","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"e484319c8f2f0bc0154ebdfab18e5dafda50ff72"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xlanex6%2Fnetlify_first_lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xlanex6%2Fnetlify_first_lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xlanex6%2Fnetlify_first_lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xlanex6%2Fnetlify_first_lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xlanex6","download_url":"https://codeload.github.com/xlanex6/netlify_first_lambda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246254150,"owners_count":20747949,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","netlify-functions","serverless"],"created_at":"2024-10-03T12:09:21.163Z","updated_at":"2025-03-29T23:14:26.296Z","avatar_url":"https://github.com/xlanex6.png","language":"JavaScript","readme":"## Netlify Lambda\n\nEverythings start with ...\n\n```bash\n npm init\n```\n\nInstall the npm package [netlify-lambda](https://www.npmjs.com/package/netlify-lambda)\n\n```bash\nnpm install netlify-lambda\n```\n\nAdd some sripts on `package.json` file, to build and serve the localhost for local development.\n\n```json\n...\n  \"scripts\": {\n    \"lambda-serve\": \"netlify-lambda serve functions\",\n    \"lambda-build\": \"netlify-lambda build functions\"\n  },\n...\n```\n\n- After, create a `netlify.toml` file for the config on root of the project.\n\n```bash\n touch netlify.toml\n```\n\nand write on it :\n\n```toml\n[build]\n    functions = \"lambda\"\n```\n\n- Create a folder 📁 `functions` on root of the project\n\n```bash\nmkdir functions\n```\n\n- Add your js file on it, for exemple.\n\n```bash\ntouch  functions/welcome.js\n```\n\nexemple:\n\n```js\n// welcome.js\n\nexports.handler = (event, context, callback) =\u003e {\n  const { name, age, nat } = JSON.parse(event.body);\n\n  callback(null, {\n    statusCode: 200,\n    body: JSON.stringify({\n      data: `hello ${name}, you're ${age} from ${nat}`\n    })\n  });\n};\n```\n\nlaunch your localhost by running\n\n```bash\nnpm run lambda-serve\n```\n\nTest with Postman on [Insomnia](https://insomnia.rest/)\n\non `POST` and URI `http://localhost:9000/welcome` like below\n\n![alternate text](./img/insomnia.png)\n\nWelcome in the new univers of Function As Service (`FASS`).\n\nIf you need to push on production, create on your favorite git storage provider but works well with [hub](https://hub.github.com/).\n\n```bash\ngit add .\ngit commit -m 'intial commit'\ngit push origin master\n```\n\nGo to your [netlify dashboard](https://app.netlify.com/) and deploy your repo.\nYou will go a url ( exemple: https://wizardly-wozniak-123c2b.netlify.com )\n\nYour endpoint will be on functions tabs of the project, and set as `PROJECT_URL/.netlify/functions/NAME_OF_YOUR_FUNCTION`\n\n- Enjoy your first lambda on netlify\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxlanex6%2Fnetlify_first_lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxlanex6%2Fnetlify_first_lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxlanex6%2Fnetlify_first_lambda/lists"}