versionpress / docs-site

Website powering docs.versionpress.net
0 stars 3 forks source link

Create a Node.js + TypeScript project #1

Closed borekb closed 8 years ago

borekb commented 8 years ago

Let's try TypeScript on this small project.

octopuss commented 8 years ago

Get information how to write project in TypeScript and use Node.js Express framework. (ask information @vasek17)

octopuss commented 8 years ago

Create separate branch - first commit into branch should erase everything.

borekb commented 8 years ago

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.

octopuss commented 8 years ago

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.).

borekb commented 8 years ago

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.)

borekb commented 8 years ago

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.

borekb commented 8 years ago

(The branch can be renamed to just nodejs-port, it will span more issues than just this #1.)

octopuss commented 8 years ago

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.

octopuss commented 8 years ago

Re branch renaming: I've renamed it to nodejs-port