Part 3 of 3: Test Express routes using Pathfinder-UI's request builder

Welcome to the last post in this series about how to use Pathfinder-UI to power your workflow when developing Express applications.

Now that you have a good sense of your app's route structure and can quickly search for any route in your app, at some you'll probably want to test those routes.

Well, instead of shuffling around with curl or POSTMAN -- as you might have already guessed -- you can test right within Pathfinder-UI.

Quickly send requests to any route

Populate a request by simply clicking on a select route in either the Tree or Table View.

Pathfinder-UI request builder

Get a pretty response

Customize the request, hit 'Send', and it'll return the response in pretty print, along with response header and status information.

Pathfinder-UI response in pretty print


Additional convenience features

The built-in request builder has a host of other convenience features to help you test your routes quickly and easily:

Customize routes with dynamic parameters

When you select a route that has dynamic parameters, Pathfinder will detect them and prompt you to customize the necessary portions.

Add query string parameters

Add query strings to your routes, and the request builder will build the composite URL for you when making the request.

Add request headers and payload data

Add additional request headers when needed, and insert payload data when making POST or PUT requests.

Save and share your request history

Your request history is saved (and persisted in Local Storage) so that repeated or similar requests can be quickly made by referring to the History Tab. Clear your history, or choose to save it to a JSON file and share the file with other team members to use, or reload it at a later time.

History Tab

And we're done!

Over the course of this series, you've learned how easy it is to use Pathfinder-UI to:

Set up Pathfinder-UI in 3 steps

Now that you have all you need to know about Pathfinder-UI, you're ready to take advantage of all of its capabilities in your development environments.

  1. Install pathfinder-ui from npm.

    $ npm install pathfinder-ui --save-dev
    
  2. Require the Pathfinder-UI module and mount it as middleware in your app at a custom path that you specify. In this case, we've defined the path as as '/pathfinder':

    // server/app/index.js (or wherever you keep your middleware)
    var pathfinderUI = require('pathfinder-ui');
    ...
    app.use('/pathfinder', function(req, res, next){
      pathfinderUI(app);
      next();
    }, pathfinderUI.router);
    
  3. In your browser, go to http://localhost:PORT/pathfinder to access the Pathfinder-UI interface and start visualizing, searching and testing!

Want to make Pathfinder-UI even better? Contribute!

Pathfinder-UI is an open-source Node and Express developer tool built by yours truly along with 3 other great talents: Sang min Lee, Ming Lei, and Tyler Pewarski. When we started this project, we set out to build an Express visualizer, route table, and POSTMAN-like tool-in-one, and we hope you find it as useful as we do when developing with Node and Express.

Of course there's always room for improvement, so we invite you to check out our source code and help make Pathfinder a better tool for the Node.js community. Fork the repo and make a pull request whenever you're ready!

Comments? Questions? Leave a note!

comments powered by Disqus