Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

REST client for NodeJS with Typescript

I am developing a nodejs web application (express) and would like to call my api.

I tryed a bunch including restangular and the jquery ajax calls.

What are good rest client libraries with Typescript definitions available?

like image 626
dknaack Avatar asked Mar 22 '16 17:03

dknaack


People also ask

Does Nodejs work with TypeScript?

TypeScript is well-established in the Node. js world and used by many companies, open-source projects, tools and frameworks. Some of the notable examples of open-source projects using TypeScript are: NestJS - robust and fully-featured framework that makes creating scalable and well-architected systems easy and pleasant.

How do I call API in TypeScript?

We will create a function getConvertedData that will house the code for fetching the API. Say we are using the Fetch API, which returns a Promise. This Promise will then resolve into an object of the type ConversionData . // API call will go here.

Is node JS GOOD FOR REST API?

The standard they use for this is called Representational State Transfer (REST), and it works perfectly with the Node. js development techniques. Owing to this level of compatibility building a Node js REST API makes absolute sense.


1 Answers

You can use fetch which is on track to becoming a standard. The link is to a polyfil for browsers that don't yet support fetch.

Type Definitions exist for it as well.

like image 67
Martin Avatar answered Sep 25 '22 00:09

Martin