I am currently trying to connect to a local server and have node run an app on port 8080. I have node and apache installed. When apache is switched on I am able to connect to the apache server externally. However when node is running and apache is stopped I cannot connect externally. I can however connect locally to node even when apache s running. Here is the code I am using:
var express = require('express');
var app = express();
var mysql = require('mysql');
var connectionpool = mysql.createPool({
host: '127.0.0.1',
user: 'root',
password: '',
database: 'development',
port: 3306,
connectionLimit: 50
});
var UAParser = require('ua-parser-js');
var bodyParser = require('body-parser');
app.use(express.static(__dirname + '/public')); // set the static files location /public/img will be /img for users
app.use(express.logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
})); // pull information from html in POST // pull information from html in POST
require('./config/signup.js')(app, express, connectionpool, UAParser);
//Setup for external access
var http = require('http');
var server = http.createServer(app).listen(8080);
console.log('Rest Demo Listening on port 8080');
Any help would be greatly appreciated. I actually had it connecting externally yesterday evening briefly.
I am not sure if i understood properly, but if you want to access your localhost externally, you will want to use something like ngrock: ngrock
According to the description it created an Introspected tunnels to localhost
You just have to run it from your shell, for example ./ngrok 8080 if your server is listening on that port, then it will connect and provide you a link. With that link your localhost is accessible from everywhere around the web. It's useful to test webhooks!