Closed borekb closed 8 years ago
Get information how to write project in TypeScript and use Node.js Express framework. (ask information @vasek17)
Create separate branch - first commit into branch should erase everything.
Some quick thoughts on using TypeScript:
(+) We use it in the main VersionPress project (so, consistency is a bonus) (+) It has a good feature set and a strong roadmap
(-) It complicates the project setup - needs to add a build step, download TSD files etc. (-) Some people might prefer plain JS or something like Babel.js
Generally, I don't think there's an especially strong case for TypeScript. Try to make it work but if it feels painful, we can go with plain JS or Babel or whatever the current preferred approach is.
I've created project in 1-nodejs-port
branch. Project is just skeleton but it is working. I will update Readme next week (how to run it etc.).
Looks good! One initial thought as discussed on Slack - maybe having both React and Jade as view libraries is one too many. (Jade is more traditional but if React works well today as a view layer even on the server, it's fine to use it.)
One more thing you mentioned is TypeScript, and the possible definition files hell. If you want to switch to Babel (plus optionally flow), feel free to.
(The branch can be renamed to just nodejs-port
, it will span more issues than just this #1.)
After some deeper thinking and reading (http://www.crmarsh.com/react-ssr/) about how should rendering be done (especially using React) I've decided not to use React as view layer. Simple Jade templates and Express.Router will be used.
Problem is that if we use React on server, and pass dynamic content to the React view/component, same content(as well as other component context from state/props) has to be available also for client side of application. This usually means downloading it via XHR, or passing it as JSON directly into html markup.
Re branch renaming: I've renamed it to nodejs-port
Let's try TypeScript on this small project.