Reputation: 9195
I have been reading multiple different articles about what Isomorphic application is, why this type of architecture is better and so forth. But I still have a bit of uncertainty as to what is meant by such term.
How would you define what "Isomorphic Application" is, without going too much into details?
Upvotes: 16
Views: 5733
Reputation: 1983
They are, more recently, also called universal
. I'm not sure about the whole app being called isomorphic/universal, but you can certainly have parts of the code base that is universal.
Isomorphic/universal code is code that runs on both the client (browser) and on the server (NodeJS). Since they are both JavaScript this something that is possible if:
window
, document
or any other browser-only methodsserver
, fs
or any or any other node-only methods.An example is console.log
which will work both within NodeJS and any browser, along with most other es6 methods in modern browsers.
I use build tools (like webpack) to then help create / export functions within individual files so that we then have a bundle
like client-app.js
which is included in the HTML file and is the browser only js. The server then might start using server-app.js
which is the server-only bundle. Both bundles can be created using a lot of the same universal
source code.
Upvotes: 21