Open linxie opened 9 years ago
MoviesList.html
from
...
to
...
Sorry. The html was cut out by the editor.
MoviesList.html
from
rel="stylesheet" href="NodeMovieList/styles/site.css" ... src="NodeMovieList/scripts/movie.js"
to
rel="stylesheet" href="/styles/site.css" ... src="/scripts/movie.js">
@linxie Your suggestions are correct if you are running the app using the node command on command prompt. The aim of the article is to show the app running on IIS using IISNODE. IIS was not able to recognize the URLs relative to root folder of the app, and so I had to prefix them with the folder name of the app.
I download the code and run got this message in the browser.
Cannot GET /
I did some modification and then it works. Here I am requesting pull or people can do these modifications.
for server.js from
app.get('/NodeMovieList', function (request, response) { response.sendfile("views/MoviesList.html"); }); app.get('/NodeMovieList/api/movies', mongoOps.fetch); app.post('/NodeMovieList/api/movies', mongoOps.add); app.put('/NodeMovieList/api/movies/:movieId', mongoOps.modify); app.use('/NodeMovieList', express.static(path.join(__dirname, 'public')));
to
app.get('/', function (request, response) { response.sendfile("views/MoviesList.html"); });
app.get('/api/movies', mongoOps.fetch); app.post('/api/movies', mongoOps.add); app.put('/api/movies/:movieId', mongoOps.modify); app.use('/', express.static(path.join(__dirname, 'public')));
MoviesList.html
from
...
to
...
movie.js
from
app.factory('moviesCRUD', function ($http, $q) { var baseurl = "/NodeMovieList/"; function getAllMovies() { var deferred = $q.defer();
to
app.factory('moviesCRUD', function ($http, $q) { var baseurl = "/"; function getAllMovies() { var deferred = $q.defer();
Then the project will work. Both versions are different from the code list in http://www.dotnetcurry.com/magazine/dnc-magazine-issue13.aspx
regards,
Lin Xie