Giter Site home page Giter Site logo

totaljs in vm (vagrant box) about examples HOT 9 CLOSED

totaljs avatar totaljs commented on August 17, 2024
totaljs in vm (vagrant box)

from examples.

Comments (9)

anoff avatar anoff commented on August 17, 2024

One finding: if i start total.js with my vm's IP framework.run(http, debug, 8000, '192.168.3.3');
i can access it via 192.168.3.3:8000 from the host.

But i don't understand why it doesn't work for localhost.

from examples.

petersirka avatar petersirka commented on August 17, 2024

Hi @extropianer, localhost is defined in host file and it's routed to:

127.0.0.1       localhost ::1             localhost

So my question: why do you need in URL localhost?
Thanks.

from examples.

anoff avatar anoff commented on August 17, 2024

Thanks for the quick reply!

Usually when i run (node) apps in my virtual machine i can access them via 127.0.0.1 or localhost from my host machine.
But when i run total.js i need to add my virtual machine IP? This works but i wonder why it is like that. I am used to 127.0.0.1

from examples.

petersirka avatar petersirka commented on August 17, 2024

Can you access into your virtual machine via 127.0.0.1 or localhost?
Is this possible? I think that no.

But when i run total.js i need to add my virtual machine IP?
Yes, but I don't know what VM you are using.

from examples.

anoff avatar anoff commented on August 17, 2024

Sorry for the late reply.
I am using vagrant box with port forwarding on 3000 (my usual port) and 8000 (for totaljs default).
If i make an express server:

var express     = require('express');
var app         = module.exports = express();

app.get('/', function (req,res) {
    res.send('hello world');
});

var port = process.env.PORT || 8000;
app.listen(port, function() {
    console.log('Listening on ' + port);
});

..everything works. So port forwarding is set up correctly. And i can access the website from outside the VM at localhost:8000 or 127.0.0.1:8000.
If i use total.js the same way it does not work.

Screenshots:

  1. http://imgur.com/CzaedZD basic express server on localhost:8000 works
  2. http://imgur.com/EDltxil totaljs example with local IP works
  3. http://imgur.com/69kdgwI default totaljs example localhost:8000 does not work

Now that i found out my VM local IP works i can start enjoying totaljs :)
Feel free to close this issue. If you want to find out why localhost:8000 does not work i can provide you with more information if needed.

from examples.

petersirka avatar petersirka commented on August 17, 2024

I don't know to help with it.
Sorry.

from examples.

meongx avatar meongx commented on August 17, 2024

Sorry to necro, but i have same problem

In the spirit of keeping our dev machine as close to production, we use VM for dev server with similiar image as deploy server. For simplicity we use port forwarding on dev server (similiar to @extropianer)

In my opinion, port forwarding doesn't work because totaljs binds to one listen address (default to 127.0.0.1)

Is there any way to make totaljs listens to ANY (*) address?

I tried using options.ip = '*', doesn't work because the address is non resolvable. Setting it to empty string options.ip = '' reverts back to default (127.0.0.1)

from examples.

petersirka avatar petersirka commented on August 17, 2024

Try to set options.ip = 'auto' and give me a feedback.
auto sets ip to undefined.

Thanks!

from examples.

meongx avatar meongx commented on August 17, 2024

setting options.ip = 'auto' does the trick

thanks a lot for the solution and fast reply :)

from examples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.