designetwork(EN)

IT technical memo of networking

Express + Node.js GET the other site responce

I sometimes want to check whether the published server is accessible from other server, and created a simple program with Express + Node.js. By doing this, you can check that you can not do it by itself, such as access confirmation to the API and certificate check of HTTPS (SSL). Points are accessed from the server (application) itself, not from the client PC.

What can be checked

HTTP/S communication confirmation (from the Web application itself)

Display StatusCode and Body. Such display.

f:id:daichi703n:20170228222338p:plain

Public program

I am publishing a program at Heroku. (Since it is a free plan, there are times when the startup is delayed)

HTTP/S Checker - Heroku

What you can not do · want to modify

Note that error handling can not be implemented, and if HTTPS communication is not possible, it will be Internal Server Error (500) …. Also, when sending form a new tab has gone up or there are many things you want to fix ….

I want to update the public program by modifying it from time to time.

Source code

The source code of Express + Node.js is released here. Please bring it freely.

As a mechanism, enter the destination URL in the form of jade and read it with Node.js as a query. Access the given URL (query) with the then-request module to acquire various kinds of information. then-request can not perform synchronization processing, but this time it worked without problems.

Conclusion - Access another site with Express + Node.js and display the result

I created a program that the application itself accessed a different site and displayed the result by Express + Node.js then-request module. By editing the display contents, it can be used for applications such as confirmation of API operation.


This Blog is English Version of my JP's.

Sorry if my English sentences are incorrect.

designetwork