0

I am using react as my client side JS and REST API's using Express 4. Do I really need to specify the view_engine parameter? I thought I dont need any view engine coz there is no serve side rendering. I use gulp to compile all the react jsx and it generates one file(single page app) I think. All the server has to do is to just serve that static compiled JS file. I dont know why I need view engine here.

Here is the error

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

user1870400
  • 6,028
  • 13
  • 54
  • 115

1 Answers1

0

Whatever the reason behind it, but application.js in Express initialises the view even though it is only used within the render method. The View class itself requires, either directly or via defaultEngine, a name of a library to load and loads it. Although if you supply engines to the options it just takes it from there by the name supplied. You could potentially dodge it at that point without making any code changes to Express itself.

Oleg Sklyar
  • 9,834
  • 6
  • 39
  • 62