postmanlabs / postman-app-support

Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
https://www.postman.com
5.85k stars 839 forks source link

exporting to code - add JavaScript/superagent #6331

Open oprogramador opened 5 years ago

oprogramador commented 5 years ago

Is your feature request related to a problem? Please describe. IMO it's a problem. Often I need a code working in Node.js from a cURL request. For JavaScript there are only JQuery AJAX and XHR. AFAIK XHR is impossible to use in Node.js and JQuery is possible but in practice practically nobody uses it because it's not the simplest way to send a request in Node.js. I prefer using superagent.

Describe the solution you'd like In this place, after clicking Code there should be additional options:

Screenshot 2019-04-21 at 02 19 32

Describe alternatives you've considered Ideally it would be to support all the most popular JavaScript HTTP calls libraries:

Additional context JavaScript is the most popular language on GitHub. Especially in context of performing HTTP requests, it's very popular because it can be used on backend (with Node.js), frontend, desktop (with Electron) and mobile (with React Native) so IMO Postman should support all the most popular JavaScript HTTP request libraries. For me, currently, superagent is enough but other JS developers are likely to want a support for other libraries and maybe even me, in the future, I will be using another HTTP calls library for some new project.

oprogramador commented 5 years ago

I see beside JavaScript, there's also NodeJS option but still it would be good to support superagent.

darshkpatel commented 4 years ago

I'd love to work on this and would love to include this in my GSoC proposal, let me know about what else can I add to this

leftering commented 4 years ago

I think this can also support generate a service lib for a collection, like:

services
-|collictionA
--| login.js
--| Auth.js
--| user.js

each '.js' file export one or some function of request and in frontend can be used directly. This is useful for large-scale application developing.

Maybe this can also generate a service lib to support some "convention dictionary" frameworks especially for React frameworks like Umi.js or egg.js. (convention dictionary also can be used in primeval React, Vue and Angularjs) This is helpful in frontend developing.

For backend, to generate a service lib to support some javascript frameworks such as: express, koa, eggjs can make backend developing like 'fill in the blank'. For example, each collecton can be a router in express framework, or a service in eggjs framework.