node.js - Express JS and SocketIO Using -


sorry guys, here ask how using express js , socket io. new kind of tech.

the 1st question is, necessary install express every project? mean, when want create new project,i create new folder, should run new command prompt, point directory , install express? if so, tell me offline please? because cant connect internet.

the 2nd question is, if use express js, shall place client file such html / javascript(front end) in same directory server file? how can run example express project external source, such github?

3rd question is, have seen lot tutorial express js + socketio. 2 things framework,right? how can use them in project / folder?

really appreciate , big if guys help, thank :)

question 01:

answer: don't have install express on each of project in order use it. can run command , install globally , can have offline.

npm install -g express 

the above command install express globally, can use offline well.

question 02:

answer: recommendation of placing static files (html/js/css/img) different folder of server-side files because don't want expose of server-side files public.

this structure should follow:

├───server.js ├───lib.js ├───views │   └───* ├───public │   ├───js │   │   └───* │   ├───css │   │    └───* │   ├───img │        └───* 

so can see above views.js of rendering files use templating system such index.html, layout.html

question 03:

answer: in express can use app.use integrate middleware or framework make work together. recommend read their api on how works.

hope help.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -