N
N
Nikita Kit2017-06-25 20:40:39
JavaScript
Nikita Kit, 2017-06-25 20:40:39

How to synchronize pug templates on the server?

Guys, I have a little blunt, I can not google the necessary information.
Intro:
For interface development I use gulp-pug, which compiles html for me on request from the server, which is raised via browserSync. Info havatsya templates from _data/info.json
I thought about the back-end. Surely you can do this so that, at the request of the user, the requested page data is first parsed in data / tmp.json and from there it would be transferred to the templates. After that, express would render the templates to the user in html. As far as I googled, pug is friends with express, which I know a little about, but very little. That there are some kind of middleware, and that it is something like methods that are applied to the app, where request, response, and callback are passed.
What role do these arguments play?
Advise me the information (preferably Russian, but not necessarily, if only it was just about this) so that I can start using pug with express on the server, and use CMF MODX only as a database, throwing off all the data in json upon request.
UPD:
Another such moment - at the request of the user, a separate directory is created just for him, a server rises to this directory for a separate user and templates are served. Is it all right? If so, does it need to be cleaned? How?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xanuho, 2017-06-29
@ShadowOfCasper

read nodejs in action book

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question