{"id":17282730,"url":"https://github.com/zenixls2/jsdom_","last_synced_at":"2025-03-26T15:54:09.030Z","repository":{"id":138003482,"uuid":"92723293","full_name":"zenixls2/jsdom_","owner":"zenixls2","description":"render webpage in lambda using jsdom","archived":false,"fork":false,"pushed_at":"2018-03-01T09:32:14.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-31T17:52:15.495Z","etag":null,"topics":["javascript","jsdom","lambda","serverless"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/zenixls2.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-29T09:00:27.000Z","updated_at":"2018-07-20T02:50:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"e8953202-ff84-43a2-a3f8-08e700e29de7","html_url":"https://github.com/zenixls2/jsdom_","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/zenixls2%2Fjsdom_","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenixls2%2Fjsdom_/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenixls2%2Fjsdom_/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenixls2%2Fjsdom_/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zenixls2","download_url":"https://codeload.github.com/zenixls2/jsdom_/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245689500,"owners_count":20656416,"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","jsdom","lambda","serverless"],"created_at":"2024-10-15T09:49:39.823Z","updated_at":"2025-03-26T15:54:09.002Z","avatar_url":"https://github.com/zenixls2.png","language":"JavaScript","readme":"# Lambda Page Rendering using jsdom\n----------------------------\n\nImprove page rendering implemented mentioned in [Qiita](http://qiita.com/peg_73_/items/b1d4ed5327f82b049850) Using jsdom.\n\n### Features\n- Faster dump speed than using phantomjs\n- Supports POST, GET, and possible other types of protocols\n- Customizable connection delay time and rendering waiting time\n\n\n### Installation\n```bash\nnpm install\nnpm run test\n```\n\n### Usage\n\nhttps://{your_lambda_endpoint}?url={URL_ENCODED}\\[\u0026delay={SECOND}\\]\\[\u0026method={METHOD}\\[\u0026dataType={DATA_TYPE}\\]\\]\\[\u0026wait={WAIT_SECOND}\\]\n\n- URL_ENCODED: target url using encodeURIComponent(url) or something equivalent\n\n- SECOND: optional, number of seconds allowed for waiting, default value = '5'\n\n- METHOD: optional, currently only support `GET` and `POST`, default value = `GET`\n\n- DATA_TYPE: optional, either `json` or `form`, only available when METHOD=`POST`. default value = `form`\n\n- WAIT_SECOND: optional, time (second) to wait for rendering html, default value = `1`\n\n### Deployment\nFirst pack whole project as zip:\n```bash\nzip -r lambda.zip jsdomrenderer\n```\n\nand create Lambda function:\n```bash\nexport AWS_DEFAULT_REGION=us-east-1\naws lambda create-function \\\n--region us-east-1 \\\n--function-name jsdomrenderer \\\n--zip-file fileb://lambda.zip \\\n--role role-arn \\\n--handler jsdomrenderer.lambdaHandler \\\n--runtime nodejs6.10 \\\n--profile adminuser\n```\n\nFor more information, see [CreateFunction](http://docs.aws.amazon.com/cli/latest/reference/lambda/create-function.html). AWS Lambda creates the function and returns function configuration information.\n\nor use cloudformation:\n\nCreate new s3bucket\n```bash\naws s3 mb s3://bucket-name --region region\n```\n\nAnd get code-uri:\n```bash\naws cloudformation package \\\n   --template-file template.yaml \\\n   --output-template-file serverless-output.yaml \\\n   --s3-bucket s3-bucket-name\n```\n\nFinally deploy using:\n```bash\naws cloudformation deploy \\\n   --template-file serverless-output.yaml \\\n   --stack-name new-stack-name \\\n   --capabilities CAPABILITY_IAM\n```\n\nSee [Create Serverless Application](http://docs.aws.amazon.com/lambda/latest/dg/serverless-deploy-wt.html) for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzenixls2%2Fjsdom_","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzenixls2%2Fjsdom_","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzenixls2%2Fjsdom_/lists"}