Skip to content
Advertisement

How to get data from custom created function in JS using https node module

How to get data from my function Data() instead of JSON PLACE HOLDER mock API using HTTPS/HTTP node module and how to make an endpoint of this get data HTTP/HTTPS module to utilize response in front end just like Angular?

My mock backen.js file:

JavaScript

Your time and help will be really appreciated. Thanks 🙂

Advertisement

Answer

Hurray! I got it using the following code and Express in node js. I simply call my custom method that creates data into an express “get” endpoint. When I hit the end point the response will be my custom method result.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement