Well... my next suggestion is to use header and footer from static files. Then, the example could be
For static files, a code like http://stackoverflow.com/questions/4062260/nodejs-redirect-url could be used. Some static text could contains something to be replace (usually, the title at <head><title>...</title></head>) First baby step: use global replace in read text, like in: https://github.com/ajlopez/NodeSamples/blob/master/MathWizard/htutil.js adapted from code http://www.packtpub.com/node-javascript-web-development/book another book with "baby steps", that is, it's not using Express from the beginning. But, at the end, I think you must bit the MVC bullit, someday. My own "learning road" was written down in https://github.com/ajlopez/SimpleMvc (with static files (thanks to Express middleware), a template engine, controllers, etc....) Angel "Java" Lopez http://ajlopez.wordpress.com http://twitter.com/ajlopez On Thu, May 31, 2012 at 12:40 PM, Ryan Schmidt <[email protected]>wrote: > > On May 31, 2012, at 10:23, Glenn Block wrote: > > > Angel was looking to not use io, but yes you definitely could. > > If the only goal is to avoid reading a file at server startup, then for > myself I don't find that a worthwhile goal and would continue to use a > separate html file for clarity. > > > > As to a string, you would need to have quotes interspersed and concat > > wouldn't you. > > I would? Oh, because JavaScript strings don't like to be multiline? I had > forgotten that. > > As far as I can tell, you don't need to intersperse quotes and concat; you > can put a backslash before the newline, but I agree that's still not as > good as being able to use the unaltered html as you can with your method. > > > > Anyway I thought this was just cool and compact. Feel free to ignore it. > > I didn't want to ignore it; I wanted to understand it. :) > > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
