This session covers the basics of developing Node.js applications with NetBeans. NetBeans includes fully integrated support for both JavaScript and Node.js. You’ll get a tour of the features and learn how NetBeans can accelerate your projects. The presentation looks at basic code editing capabilities provided by the IDE, tool integration (npm/Grunt/Bower/Webpack), frameworks such as Express, and debugging capabilities. You’ll see why NetBeans is the best free JavaScript/Node.js IDE.
5. NetBeans Misconceptions
Following statements are NOT TRUE:
• JavaScript support is secondary
• JavaScript integration is just for Java web apps
• Projects must be created with NetBeans
• Projects must be refactored to use NetBeans
• NetBeans can’t deal with framework x and/or build tool y
etc.
NOT TRUE
18. Customizable Palette
• Drag HTML elements from Palette into HTML Window (Wizard appears)
• Drag selections from HTML document to Palette to create new HTML
snippets.
30. Typical Workflow
npm init Edit package.json npm install
NetBeans performs these tasks for us.
Shell commands can be executed at any point
– not locked into the IDE.
33. Unit Testing
• Supported Unit Testing frameworks:
• Karma
• JS Test Driver
• Mocha
• Demo
• Jasmine – JavaScript unit testing framework
• Tests written in JavaScript
• Test synchronous and asychronous JavaScript code
• Karma – JavaScript test runner
• Based on NodeJS
• Launches and executes tests in web browser
34. Unit Testing Setup
• For empty projects:
• Add dependencies in package.json
• Create karma.conf file
• Configure testing
• Implements tests
• For existing projects:
• Open project properties and configure
38. What is AWS Lambda?
• Function as a Service (Faas) from AWS
• Stateless function that executes in the cloud
• Executes in response to events (S3, DynamoDB, API
Gateway, etc)
• Can be implemented using
• JavaScript (Node.js), Java, Python C#
• Billed on executions:
• First million executions are free
• $0.20 per each million afterwards
39. Example Lambda Function
exports.handler = function(event,context) {
context.succeed('Hello ' + event.firstName + ' ' +
event.lastName + ' you are at JavaOne 2017!');
};
{
"firstName": "Ryan",
"lastName": "Cuprak”
}
Handler
Function
40. SAM – AWS Lambda Testing
https://github.com/awslabs/aws-sam-local
41. AWS Lambda & NetBeans
• NetBeans can test AWS Lambda locally
• Prerequisites:
• Install Docker
• Install SAM Local - npm install -g aws-sam-local
• Steps:
1. Create a Node.js project in NetBeans
2. Add aws-sdk to project via npm
3. Implement function
4. Add yaml configuration file
5. Add scripts entry to launch SAM
42. AWS Lambda & NetBeans
Debugging steps:
1. Start SAM in debug mode
2. Trigger event for invocation
3. Attach debugger