Is it possible to have NodeJS and MAMP running together on the same machine? If so how would i achieve this?
Note: I can run them separately just not together. I assume its down to my NodeJS using the "localhost" as well as MAMP.
Is it possible to have NodeJS and MAMP running together on the same machine? If so how would i achieve this?
Note: I can run them separately just not together. I assume its down to my NodeJS using the "localhost" as well as MAMP.
You can setup Proxy and a host.
for example create node01.example.com in Hosts. Then Go to Advanced and enter the following in "Customized virtual host general settings"
ServerAlias node01.example.com <Location /> ProxyPass http://127.0.0.1:3000/ ProxyPassReverse http://127.0.0.1:3000/ </Location>
when you visit node01.example.com you'd pass through MAMP and go to your node ;)
This depends on what you want NodeJs to do?
Are you using NodeJS to work as a webserver?
You could set it to run on another port number - this would let you access it through:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
Then visit http://localhost:1337