All Projects → RootedGlobal → node-casperjs-aws-lambda

RootedGlobal / node-casperjs-aws-lambda

Licence: other
Base scaffolding app for a casperjs/phantomjs app running on Amazon (AWS) Lambda

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to node-casperjs-aws-lambda

ncg-crud-ngx-md
Angular 4+ Material Design CRUD/Admin app by NinjaCodeGen http://DNAfor.NET
Stars: ✭ 36 (-30.77%)
Mutual labels:  angular-material, angular-cli
Angular Interview Questions
Most extensive Angular interview questions based on your level.
Stars: ✭ 354 (+580.77%)
Mutual labels:  angular-material, angular-cli
Angular-Movies
Angular Movies | TV Shows is a simple web app that consumes The Movie DB API - Angular 13 + Material Angular
Stars: ✭ 35 (-32.69%)
Mutual labels:  angular-material, angular-cli
Document-Management-System
DocKip is a document management system for managing and sharing documents: Staging => http://dockip-staging.herokuapp.com. Production =>
Stars: ✭ 26 (-50%)
Mutual labels:  angular-material, mean-stack
Angular5 Seed
Angular5 Seed for Application
Stars: ✭ 222 (+326.92%)
Mutual labels:  angular-material, angular-cli
ng-math
Math Flashcard Progressive Web App built with Angular 2
Stars: ✭ 17 (-67.31%)
Mutual labels:  angular-material, angular-cli
Angular Ssr
Angular 4+ server-side rendering solution compatible with @angular/material, jQuery, and other libraries that touch the DOM (as well as providing a rich feature set!)
Stars: ✭ 283 (+444.23%)
Mutual labels:  angular-material, angular-cli
Devilbox
A modern Docker LAMP stack and MEAN stack for local development
Stars: ✭ 3,598 (+6819.23%)
Mutual labels:  mean-stack, lamp-stack
Ng Demo
🦴 Bare Bones Angular 10 and Angular CLI Tutorial
Stars: ✭ 154 (+196.15%)
Mutual labels:  angular-material, angular-cli
Angularconcepts
Key Angular Concepts using Latest Angular version 5
Stars: ✭ 31 (-40.38%)
Mutual labels:  angular-material, angular-cli
awesome-angular
💖 A list of awesome Angular (2️⃣➕) resources
Stars: ✭ 61 (+17.31%)
Mutual labels:  angular-material, angular-cli
Rwa Trivia
Trivia App - Real World Angular series
Stars: ✭ 251 (+382.69%)
Mutual labels:  angular-material, angular-cli
meditation-plus-angular
DEVELOPMENT MOVED TO
Stars: ✭ 15 (-71.15%)
Mutual labels:  angular-material, angular-cli
login-form-angular2
A simple login form using the angular2 material design and the angular-CLI.
Stars: ✭ 21 (-59.62%)
Mutual labels:  angular-material, angular-cli
angular-starter
🚀 Angular 14 Starter with Storybook, Transloco, Jest, TestCafe, Docker, ESLint, Material & Prettier 🚀
Stars: ✭ 124 (+138.46%)
Mutual labels:  angular-material, angular-cli
Ajsf
Angular JSON Schema Form
Stars: ✭ 266 (+411.54%)
Mutual labels:  angular-material, angular-cli
Date Time Picker
Angular Date Time Picker (Responsive Design)
Stars: ✭ 528 (+915.38%)
Mutual labels:  angular-material, angular-cli
Angular Ngrx Material Starter
Angular, NgRx, Angular CLI & Angular Material Starter Project
Stars: ✭ 2,623 (+4944.23%)
Mutual labels:  angular-material, angular-cli
fire-drill
Find, Edit, Add, Remove, Import, Export, and Report on your Firebase data
Stars: ✭ 58 (+11.54%)
Mutual labels:  angular-material, angular-cli
MailHookBundle
A bundle to catch API webhook from different mail service
Stars: ✭ 36 (-30.77%)
Mutual labels:  amazon-web-services

CasperJS AWS Lambda Template

A CasperJS node.js app for Amazon Lambda. Based on node-lambda-template using node-lambda. The app includes a PhantomJS binary (i.e., in the /bin/ directory named: phantomjs) compiled for AWS Linux (https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2).

Note: If you want to use different PhantomJS binary in your project, then you will be need to download a latest binary from here and replace it with /bin/phantomjs (i.e., Make sure you keep the name as is for now).

Table of Contents

Installation

Clone the project:

$ git clone https://github.com/narainsagar/node-casperjs-aws-lambda.git

Install dependencies using npm. It'll install the AWS SDK as well as PhantomJS on the development machine.

$ npm install # yarn

Usage

After installing use the following npm commands as described below. They're only wrapping the node-lambda functionality to allow node-lambda to be installed only locally. Additional params can be provided using -- args. For a list of available options see the node-lambda documentation.

There are the 3 available commands:

  • setup: $ npm run setup
  • start: $ npm run start
  • deploy: $ npm run deploy

Run the $ npm run setup command to generate the .env environment file with the default configuration used for the Amazon Lambda function.

You need to edit the resulting .env file with your custom settings.

For this you need to have aws account and fill out confuguration in .env file:

AWS_ENVIRONMENT=development
AWS_ACCESS_KEY_ID=your_key
AWS_SECRET_ACCESS_KEY=your_secret
AWS_ROLE_ARN=your_amazon_role
AWS_REGION=us-east-1
AWS_FUNCTION_NAME=
AWS_HANDLER=index.handler
AWS_MODE=event
.....
.....
AWS_RUNTIME=nodejs
....

FYI: You can also specify nodejs version for AWS_RUNTIME config option. i.e.,

AWS_RUNTIME=nodejs6.10

To generate .env environment file run the following command:

$ ./node_modules/.bin/node-lambda setup
# OR
$ npm run setup # yarn setup

To run the function locally execute the following command:

$ ./node_modules/.bin/node-lambda run
# OR
$ npm run start # yarn start

Run the following command to deploy the app to Amazon Lambda:

$ ./node_modules/.bin/node-lambda deploy
# OR
$ npm run deploy # yarn deploy

For running tests:

$ npm run test # yarn test

For more about commands visit node_lambda repository here

Note: npm version 2.x or newer required to pass arguments to the scripts using -- args

Understanding the Codebase structure

This describes the app directory structure & conventions.

.                               # project root directory
├── node_modules                # project dependencies directory
│   ├── .bin                    # node_modules bin directory
│   ├── casperjs                # casperjs executable
│   ├── phantomjs               # phantomjs executable
│   └── ...                     # etc
├── bin                         # bin directory
│   ├── phantomjs               # local phantomjs executable
│   └── ...                     # etc
├── src                         # source files
│   ├── scripts                 # directory contains all casperjs scrapping scripts.
│   │   ├── sample-script.js    # sample casperjs script
│   │   └── ...                 # etc
│   ├── runner.js               # dynamic casperjs script runner
│   ├── utils.js                # utility functions inside here.
│   └── ...                     # etc
├── test                        # directory contains test files
│   ├── basic.js                # sample basic test
│   └── ...
├── .env                        # it is where you place your AWS deployment configuration
├── .gitignore                  # exclude files/etc to be tracked & pushed on git (i.e., local configuration, credentials, dependencies, etc.)
├── deploy.env                  # it has the same format as `.env`, but is used for holding any environment/config variables that you need to be deployed with your code to Lambda but you don't want in version control (e.g. DB connection info)
├── event.json                  # it is where you mock your event
├── index.js                    # app main entry point
├── package.json                # project details (i.e., version, author info, dependencies, etc.)
├── README.md                   # project documentation guide.
└── ...                         # etc

Contributing

About Me

My name is Narain Sagar, I’m a FullStack JavaScript Developer, lives in Karachi, Pakistan and pretty much enjoying my life.

@narainsagar

Follow Me 👍

Medium | Website | Twitter | LinkedIn | Facebook | Github | Stack Overflow

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].