Friday, 9 June 2017

Why do I need a view engine (jade/pug) just to use res.json();

On my server all controllers get data from MongoDB and sends it back to angular as JSON format using res.json(result);

Do I need pug or jade etc.. just to send a json result?

If I dont have jade, I get this error:

Error: No default engine was specified and no extension was provided.

And if I install jade, then I get this error:

Failed to lookup view "error" in views directory "G:\Dropbox\ThaiHome\Github\server\views"

(I do not have a \views\ folder on the server, do I need to create that to send json?)

Is there a basic simple way to do setup my nodejs server to just parse json to angular?



via torbenrudgaard

No comments:

Post a Comment