This is probably a really basic question.
I'm new to node.js.
I'm writing a script which receives an HTTP POST request. I'm going to be deploying to Heroku, but while I'm testing locally how do I make POST requests to the script?
Thanks.
You can use chrome extension called postman.
If you're on unix (OSX, Linux, BSD) or have an environment where you can download/use unix tools (cygwin, git bash) you can use curl:
curl -XPOST http://localhost/my/app -d 'data you want to post'
If you're using Google Chrome or you're on a Mac install Postman
Related
I am very new to the hapi-fhir, I have download source (hapi-fhir-5.2.0-standard-distribution) from below link. I am trying to deploy the server on localhost.
https://github.com/hapifhir/hapi-fhir/releases/tag/v5.2.0
OS: ubuntu 16.04
java version: 1.8.0_275
Please help me with deployment procedure ?
If you just want to play with a FHIR server, I'd recommend learning the resources, search params, etc. using a public reference server, e.g. http://hapi.fhir.org/baseR4/
If indeed you need to get started locally, try the Docker installation of the jpa server: https://github.com/hapifhir/hapi-fhir-jpaserver-starter#running-via-docker-hub
The CapabilityStatement will tell you what the server can do: http://localhost:8080/fhir/metadata
To search a resource: http://localhost:8080/fhir/ (e.g. http://localhost:8080/fhir/Patient)
The server will be empty, so you'll need to POST/import data.
I have just recently started learning about APIs as party of Full stack developer course. Everything has been working fine until I have activated system storage sense in Windows to clear some space in the disk /c, the curl command stopped working and is giving internal server error.
curl calling request error using bash terminal
I have realized there is an issue when I have run my code and it stopped pulling information from the API link.
Since you made a windows change my guess would be - try addding the curl folder path to your Windows PATH environment variable so that the curl command is available from any location at the command prompt.
I just installed curl on a Linux machine.
I have a webserver and web page.
I also have a test program that will send rti messages to the web server.
I want to be able to use curl to look at messages that are being received by the web server and were by the test program.
I am using localHost:8080
I am new to curl but have heard that I should be able to see the messages.
What command syntax should I use with curl
thanks
I think that what you mean is tcpdump or wireshark if you wish to inspect the traffic to your webserver
Merry Christmas!
I am trying to configure KMS on my Ubuntu 14.04 (64 bit). I could install the KMS server successfully following the guide at https://www.kurento.org/docs/6.0.0/installation_guide.html.
Also, downloaded the Javascript HelloWorld tutorial from https://www.kurento.org/docs/6.0.0/tutorials/js/tutorial-1-helloworld.html. I could run the example successfully on localhost on Google Chrome Version 47.0.2526.106 (64-bit) on the same Ubuntu System.
But, I could not see the local video nor the loop backed video. Only a spinner icon is shown on both the Video placeholders. Consulting the Console log reveals a problem after creating the SDP offer. The error is as described below.
kurento-client.js:21072 WebSocket connection to 'wss://127.0.0.1:8433/kurento' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
I am no expert on web sockets and stuff. Any help on this would really help me to proceed forward.
Note: I am running the example on HTTP, not on HTTPS. I guess that would not be the cause of the problem, though.
Regards,
LazyCoder7
I managed to solve it. I was wrong on my guess though, HTTPS was indeed required in order to make the WebSocket connection ( i was not aware of that part ). Created a certificate file (.pem) (from crt and key file already in the helloworld folder) and configured the KMS server to use the certificate. After this I was able to see myself and the same me in loopback :)
You are following an old version of the documentation. Since Chrome 47, in is mandatory to server pages through HTTPS if you want to use the getUserMedia APi. So we updated all our tutorials, and they now have a self-signed certificate. In case of the JS tutorials, you also need to configure KMS to expose a secure WS signalling connection, as the browser directly connects to the media server to control it.
Please follow the latest version of the documentation here
Be sure that the KMS is running on the port 8433 (not 8888), if you are using docker
docker run -d --name kms -p 8433:8433 kurento/kurento-media-server:trusty-latest
I call a Rest API from node.js and Postman-Rest Client (chrome app).
Always using the same computer, same endpoint and same parameters.
In node.js I get ~400ms for http and ~700ms for https.
In Postman I get ~250ms for http and https.
Libraries I used in node.js: http, https, request, kinvey (node client of the api). All of them got the the same result more or less.
Why my node is slower?
node.js 0.10.36
Edit:
it's not about node, i get the same result with curl.
when running in browser using XMLHttpRequest i get better times.
from analysing the logs I found that TCP connect and SSL handshake takes about 500ms. It may be that TCP connect and SSL handshake works differently in browser.
Here you can find some help.
I am also facing issues with nodejs application server on linux instance. But dont blame nodejs as real issue is in linux systems.
Issue : any outbound request from machine need to find the domain , hence it always lookup the DNS entries & always handshakes with secure/unsecure protocols. This is actually the time taking scenario.
You can verify by doing CURL request.
curl --trace-time -v https://outboundserver.com
Solution : We have to White List IP of outbound server in our own DNS entries. take a look below ...
IN Windows : automatically does the mapping of servers in own dns entries.
IN Linux : We have to manually add the hosts corresponding to IP Address.
Manually add an entry in /etc/hosts file below any configuration like localhost.
127.0.0.1 localhost
outbound.servers.ip.address www.outboundserver.com
Finally check with the curl request again, it should give faster response.
curl --trace-time -v https://outboundserver.com