Running a node application with different domains

91 Views Asked by At

I have a node application that creates an API for the frontend to reference. Snippet below:

var app = express();

app.post("/api/login", function(req, res){  
  //login code
});

app.listen(8080);

Now if I go to localhost:8080 everything works great as expected. However, I also have local.framework setup as a virtual host pointing to the frontend directory. When I visit local.framework, the website loads fine (it's finding the frontend stuff) but references to the API return 404 not found errors.

How can I ensure my domains are linked up with the node backend correctly?

0

There are 0 best solutions below