Meteor not being able to connect to prerender.io server - javascript

I have set up a prerender server on my local machine.
It is on port 3033 and it seems to display a rendered version of my meteor site when I type this in
curl http://localhost:3033/http://localhost:3000/?_escaped_fragment_=
Knowing that my prerender site works, I'm trying to set it up so that if I go to
curl http://localhost:3000/?_escaped_fragment_=
it should give me my Meteor site.
I'm using this package (https://github.com/dfischer/meteor-prerenderio) and I've got this line in my settings.json file
"PrerenderIO": {
"prerenderServiceUrl": "http://localhost:3033/"
}
However, when I run
curl http://localhost:3000/?_escaped_fragment_=
it returns nothing and I'm getting this message shown up on my meteor server log
res.send(status, body): Use res.status(status).send(body) instead
and it doesn't seem to be hitting the prerender server.
What is this message and why aren't I able to hit the prerender server?

Related

Connection Refused While Accessing API

I have a nginx server where I have an api deployed at localhost:5000
On the same server I have a Vuejs app which is deployed at localhost:3000 and then through nginx reverse proxy served from www.mysite.com.
the frontend uses axios to make calls to the api. But everytime it happens, I get a connection refused error to localhost:5000.
Why is this happening and how can I resolve it.
Note: If I serve localhost:5000 api also via a domain like api.mysite.com using nginx reverse proxy and call api from this domain then it works fine. But I don't want to do that and instead want to use localhost:5000 to call the api.
Please check the port is listed by using the following command if you use Linux
sudo netstat -tnlp | grep :5000
If there is process running, then fine. Try changing the localhost to 127.0.0.1:5000

Node.JS: Why is my connection to localhost:3000 refused?

I'm a student going into back-end development for the first time and are trying to learn Node.JS. I downloaded a pdf book about Node.JS from sitepoint called: "Jumpstart Node.JS". In following the instructions to set up the server on the command line, install the dependencies, and navigate to localhost:3000, i got nothing except the following message: "Connection refused: localhost:3000", Can somebody please tell me what might have went wrong and how to fix it?
Edit1:
The instructions i followed is about setting up a node.js server using the Node command line, thus no code, simply cmd commands, however, here is a quick summary of the process i followed:
Created an account on MongoLabs and then a database using the free pricing plan.
Installed express using the command: npm install -g express#.2.5.8.
Created an applications with default options using this command: express authentication.
modified the package.json file in system32
installed the dependencies by typing cd authentication, hitting enter, and then typing the command: npm install
Typed node app and hit enter.
According to the instructions i should have seen a message: "Welcome to express" but instead got the error message.
In following the instructions to set up the server on the command line, install the dependencies, and navigate to localhost:3000
It seems that you didn't start the server.
Somewhere between installing the dependencies and navigating to the URL you need to actually start the server if you want it to serve the request.
Check that there is no copy of the server running in the background, or that another app is using the port currently.
(Your firewall show allow you to see which app has been allocated to that port)
Because nodejs requires it to be the only app on that port running on your computer.
Also try a different port maybe?

Mean app login not working on heroku

I have followed many tutorials on how to get mongodb and MEAN to work on heroku, and none of them have worked for me, I keep getting the 503 application error.
First I create the app, I do heroku addons:docs mongolab in the commandline, and after that I check my config and change my code so the mongoose connection is changed to the config string like this:
mongoose.connect(process.env.MONGOLAB_URI || mongodb://example:example#ds053312.mongolab.com:53312/todolist');
the second part is just an example, the one I use is the one with my information.
So after this I push my app to heroku, but when I try to run it, it still gives me the application error, and in f12 it says it's
Failed to load resource: the server responded with a status of 503
(Service Unavailable)
https://myapp.herokuapp.com/favicon.ico
What am I doing wrong? I have tried everything and none of the tutorials are working for me
EDIT: I have managed to get rid of the error by doing the following:
$ git init
$ git add .
$ git commit -m "initial version"
$ heroku apps:create
however, now that my app loads, it appears that the login and sign up features of my app doesn't work, I fill out the sign in/log in form and submit but the page just stays where it is without changing. Is there something else I was supposed to do to get these features to work?
I came here because my Heroku - deploy Login wasn't working, but Localhost was. Turns out I forgot to change the Login POST route.

How to access remote node.js app in browser, not on localhost

I'm trying to set up a simple "Hello world" node.js app.
I've created the following index.js file:
var app = require("express")();
var http = require("http").Server(app);
app.get("/", function(req, res){
res.send("<h1>Hello worlddddd</h1>");
});
http.listen(8080, function(){
console.log("listening on *:8080");
});
When I open up my local console, and perform node index.js, I get the message "listening on *:8080", as expected. I point my browser to localhost:8080, and I see the HTML page saying "Hello worlddd", as desired.
Now, I'm trying to do the same on my Virtual Private Server, so I can access the same app from different computers, but all I get is connection timeouts. I've followed these steps:
Install node.js on my VPS
Install express via npm install --save express#4.10.2
Upload my index.js file to the var/www/html folder on my server with IP 192.123.123.12 (an example, this isn't my real IP).
Access the server via PuTTY, and run node index.js, where I get "listening on *:8080", so I know node.js is working.
Now I point my browser to http://192.123.123.12:8080 and after about 20 seconds, I get the browser error: "The connection has timed out".
I've tried listening to port :80 instead, but I get the error that this port is already in use.
Does anybody know what I'm doing wrong? Am I using the wrong port? Am I pointing to the wrong URL? Do I need to modify my server preferences? (running Apache on CentOS). I've only found dozens of tutorials that teach you how to run a node.js app on your local computer(pointing the browser at localhost:8080), but I need it to run on my remote server so multiple computers can access the same app.
The issue is that your current filters (iptables) block traffic unless you explicitly allow it.
You just need to open port TCP 8080 inbound, and you should be able to reach your node.js server!

tern_for_vim (ternjs) returns 403 access denied

Trying to get JavaScript completion working in MacVim, using YouCompleteMe + TernJS.
I've followed the install instructions for both plugins (I use Vundle to manage vim plugins), which included running ./install.sh script inside the YCM plugin folder, and npm install inside the TernJS plugin folder. Installation of both appears to have completed successfully.
However I'm not getting any JS completions as I type; and if I try to manually trigger something in TernJS (eg. :TernDef), I get a HTML error page back from the local TernJS server, indicating a 403 Access Denied error.
If I launch MacVim with sudo (eg. sudo mvim); everything seems to work fine.
Also, without sudo, I can manually post a JSON document to the TernJS server (outside of vim) and get a valid response back.
I'm running MacVim 7.4.71 (installed via Homebrew; compiled with python support ), and node 0.10.21 (also installed via Homebrew).
Any ideas on what I could check, so that I can have TernJS completions without needing to use sudo to launch MacVim?
Figured it out.
My shell profile was setting the $http_proxy env variable so the requests from MacVim to the local TernJS server were trying to go out through a proxy server.
Fixed by adding export no_proxy=localhost to my shell profile, so that requests to http://localhost don't use a proxy.

Categories

Resources