A bit new to the JS and Node landscape. I would like to ask you few questions. I had a simple site, with a structure imagine like:
mysite
--index.html
views
--list.html
--add.html
Now I wanted to serve my site from Node. All I did was restructure it in this way:
mysite
index.js
public
--index.html
views
--list.html
--add.html
In index.js added ability to serve static pages:
var app = express();
app.use(express.static(__dirname + "/public"));
Finally, now also say from list.html I want to issue an AJAX to my node server, for that I have (inside script):
$.get("/listofmovies", function(data, status){});
and on node:
app.get("/listofmovies", function(request, response){});
This all seems to work, my only question is:
is this the right way (or one of right ways) to set up a web site like this? and run it on node server?
via Giorgi Moniava
No comments:
Post a Comment