{"id":21189038,"url":"https://github.com/sackrin/react-micro-ui-lambda","last_synced_at":"2025-03-14T20:41:59.041Z","repository":{"id":42778277,"uuid":"275457866","full_name":"sackrin/react-micro-ui-lambda","owner":"sackrin","description":"This library adds the ability to quick host a micro UI within the AWS lambda environment. The library works alongside the react-micro-ui library.","archived":false,"fork":false,"pushed_at":"2022-12-13T04:23:26.000Z","size":1238,"stargazers_count":0,"open_issues_count":13,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-21T13:23:29.823Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sackrin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-27T21:43:02.000Z","updated_at":"2020-07-09T06:30:10.000Z","dependencies_parsed_at":"2022-08-23T06:40:45.439Z","dependency_job_id":null,"html_url":"https://github.com/sackrin/react-micro-ui-lambda","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sackrin%2Freact-micro-ui-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sackrin%2Freact-micro-ui-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sackrin%2Freact-micro-ui-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sackrin%2Freact-micro-ui-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sackrin","download_url":"https://codeload.github.com/sackrin/react-micro-ui-lambda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243646524,"owners_count":20324582,"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":[],"created_at":"2024-11-20T18:49:43.739Z","updated_at":"2025-03-14T20:41:59.006Z","avatar_url":"https://github.com/sackrin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Micro UI Lambda\n\nThis library adds the ability to quick host a micro UI within the AWS lambda environment. The library works alongside the react-micro-ui library.\n\n## Installation\n\n```npm i -s @sackrin/react-micro-ui-lambda```\n\n## Usage\n\nwithin your micro ui src/lambda.js\n\n```\nimport path from 'path';\nimport { ExampleComponent } from './Components';\nimport createLambdaMicroUI from '@sackrin/react-micro-ui-lambda/lib/createLambdaMicroUI';\n\nexports.handler = async (event, context) =\u003e {\n  // Retrieve the local config\n  const microUIConfig = require(path.join(process.cwd(), 'microui.config.js'));\n  // Create the Lambda\n  const { route, strap, boot, env, config, logger } = createLambdaMicroUI(event, context, 'http', {\n    profile: process.env.PROFILE || 'local',\n    config: microUIConfig,\n  });\n  // API ENDPOINTS\n  route('/example', 'GET', doExampleEndpoint);\n  // SERVER SIDE RENDERED COMPONENTS\n  // Strap in the front end components\n  strap('ExampleComponent', ExampleComponent);\n  // Boot and handle the response\n  return boot(event, context);\n};\n```\n\n## Create Lambda Micro UI\n\n### createLambdaMicroUI\n\nUse this to create your micro UI lambda\n\n- event: the aws lambda event\n- context: the aws lambda context\n- mode: http or rest depending on your API gateway\n- config: the micro UI config\n- profile: the environment profile ie local, dev, stage\n- logger: your choice of logger\n\n```const { route, strap, boot, env, config, logger } =  createLambdaMicroUI(event, context, mode, { config, profile = 'local', logger = console })```\n\n## Callbacks\n\n### route(path, method, handler)\n\nUse this to bootstrap API endpoint handlers\n\n- path: the api path\n- method: GET | POST | PUT | DELETE\n- handler: the handler which will be invoked\n\n```route('/example', 'GET', doExampleEndpoint)```\n\n### strap(name, component)\n\nUse this to bootstrap react components for server side rendering. Not required if you do not intend on providing server side rendered components.\n\n- name: the name of the component\n- component: the react component\n\n```strap('ExampleComponent', ExampleComponent)```\n\n### boot(event, context)\n\nUse to handle a lambda request\n\n- event: the aws lambda event\n- context: the aws lambda context\n\n```boot(event, context)```\n\n## Extras\n\n### env\n\nThe current resolved environment the micro UI is using. This is calculated via the micro UI config and the supplied profile\n\n### config\n\nThe current config the micro UI is using.\n\n### logger\n\nThe current logger the micro UI is using. This will either be the logger you supplied or the default logger (console)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsackrin%2Freact-micro-ui-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsackrin%2Freact-micro-ui-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsackrin%2Freact-micro-ui-lambda/lists"}