Giter Club home page Giter Club logo

paw-nodehttpcodegenerator's Introduction

Build Status

Node.js Code Generator (Paw Extension)

A Paw Extension that generates Node.js (without dependencies) code.

At least Node.js 4.x is required (arrow functions, consts, etc). No additional npm depenencies in resulting code.

Installation

  • Checkout this repo
  • type 'make install'

Development

Build & Install

make install

Watch

During development, watch for changes:

npm install 
npm run watch

Tests

There are some basic functional tests, which might be run using test/test.sh

License

This Paw Extension is released under the MIT License. Feel free to fork, and modify!

Copyright © 2016 Andrian Budantsov

paw-nodehttpcodegenerator's People

Contributors

andrianbdn avatar

Watchers

 avatar  avatar

paw-nodehttpcodegenerator's Issues

Support exports of more than one request in one pass

Since 2.3.2 paw supports exporting many requests at once see the docs https://luckymarmot.com/paw/doc/extensions/create-code-generator

The generate method gets, a list of requests that the user would like to export.

this.generate = function(context, requests, options) {
     var generated = "";

     // iterate requests (`Request` objects)
     for (var i in requests) {
         var request = requests[i];

         // iterate on request headers
         var headers = request.headers;
         for (var header_name in headers) {
             var header_value = headers[header_name];
             // do something
         }

         // get the latest response status code
         var status_code = request.getLastExchange().responseStatusCode;

         // get the latest response body
         var body = request.getLastExchange().responseBody;

         generated += status_code + "\n" + body + "\n\n";
     }

     // return the generated string
     return generated;
}

JS Exception Line 27. TypeError: undefined is not an object (evaluating 'request.length')

Node -v -> v5.7.1
npm --version -> 3.6.0

Paw Extension Log:

Event Loaded extension io.andrian.PawExtensions.NodeHttpCodeGenerator
Event Loaded extension io.andrian.PawExtensions.NodeHttpCodeGenerator
JS Exception Line 27. TypeError: undefined is not an object (evaluating 'request.length')
JS Exception Line 27. TypeError: undefined is not an object (evaluating 'request.length')

Install seems fine:

make install
mkdir -p "/Users/<userdir>/Library/Containers/com.luckymarmot.Paw/Data/Library/Application Support/com.luckymarmot.Paw/Extensions/io.andrian.PawExtensions.NodeHttpCodeGenerator/"
cp README.md NodeHttpCodeGenerator.js LICENSE "/Users/<userdir>/Library/Containers/com.luckymarmot.Paw/Data/Library/Application Support/com.luckymarmot.Paw/Extensions/io.andrian.PawExtensions.NodeHttpCodeGenerator/"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.