They have lots of powerful features you might like. If you want to get even more advanced or customized, check out the WebStorm docs. This covers the most essential serverless-specific setup for WebStorm. Open it by Clicking on Tools > Test RESTful Web Service: Final Thoughts It includes most of what you need right inside your editor, so that you don’t need to use another REST client such as Insomnia or POSTMAN. The WebStorm REST client is a lot easier to use than curl. Luckily for us, WebStorm comes in with a built-in REST client that you can use to test your deployed serverless endpoints. REST APIs are one of the most common use cases for serverless applications. Note: I won’t be going deep into how to set up the WebStorm debugger in this post, but you can check out this other walkthrough if you’d like. Once you get used to this debugger, you’ll probably never use console.log() for debugging again! WebStorm will then show you tons of crucial information and data about your code and its context. You set it up once, define your break points, then run it. Running those tests is a breeze with WebStorm, and they become extra useful when you use them with WebStorm’s built-in debugger. When it comes to testing my serverless applications, I personally try to aim for around 80% code coverage via unit tests, plus a one or two handler integration tests. This makes it very easy to quickly run individual test cases/suites with a point-and-click interface.Īll you have to do is install your favorite testing framework, and WebStorm will detect it. WebStorm comes with first class support for many testing frameworks, including Jest (my personal favorite). Step 3: streamline your testing & debugging You can follow the same steps if you’d like to add other tasks as well, such as sls invoke. Click on the + sign at the bottom left, and add the following settings: To add the Serverless Framework as an external tool, go to WebStorm Preferences > Tools > External Tools. Well, luckily WebStorm allows you to hook up external tools, have them available to the IDE UI, and even assign keyboard shortcuts to them! Wouldn’t it be so awesome if you could hit COMMAND + SHIFT + D to instantly deploy your service? That’s what I thought too. Integrating with the Serverless Framework From there, you can view the built-in templates, see how they work, and create your own. To set up your own live template, go to WebStorm Preferences > Editor > Live Templates > JavaScript. Here’s an example live template that auto generates a simple function by typing fn + tab: It allows for custom-made auto code completion when you type a trigger keyword. Live Templates is probably one of WebStorm’s best features. Step 2: Start using serverless Live Templates Let’s move on to one of my favorites: Live Templates. Open WebStorm Preferences > Editor > Inspections > JavaScript and disable all rules except for the Standard Code Quality Tool. Now you’ll need to disable WebStorm default inspections. WebStorm will detect it and ask you if you’d like to use it as your project linter. To set it up on WebStorm, just add it to your devDependencies. It’s the simplest of them all and provides a zero-config experience. You can use any linter you want, but my personal favorite is the Standard linter. Here’s the kind of feedback WebStorm provides for you once you’ve set up your linter: It provides instant feedback on any typos that you might have missed, saving you tons of time correcting basic errors. Step 1: set up a linterĪ linter is a must-have during any coding session, especially when it’s integrated to your IDE. Now that the basics are out of the way, we’re going to talk about the four key WebStorm features I use to help me code (and debug) even faster. You’ll also need to download and install WebStorm. Then, create a new project using the aws-nodejs template: serverless create -t aws-nodejs. If you haven’t already, install the Serverless Framework: npm install serverless -g, and type serverless login to create your Platform account. ways to streamline testing and debugging.Live Templates (to integrate keyboard shortcuts for the Serverless Framework).creating a brand new serverless project.In this post, I’d like to share with you my serverless-specific IDE setup, and how it can massively accelerate your serverless workflow. And I recently thought to myself, “Oh, I bet lots of other serverless devs out there might find this useful!” Over the past few years, I’ve been fortunate enough to work exclusively on serverless tooling.ĭuring that time, I put together a certain workflow that integrates quite nicely with my IDE of choice: WebStorm. If you build serverless applications, here’s a serverless-specific IDE setup that will help you streamline your workflow.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |