Skip to content

Latest commit

 

History

History
114 lines (76 loc) · 3.35 KB

guide.md

File metadata and controls

114 lines (76 loc) · 3.35 KB

Guide express block

Once plugged the block on the base generated with:

	yo stack-lego:block express

alt express block

Then start, express have much functions to do routing, authorization, statics files etc.. this block split all this functions with a command for each one:

Warning

Please don't remove the comments, this block exits two streams for build one app

1- All on the main files

Just when the generator asking for something like if you wanna create one folder for something answer no allway, this way mean everything will be generated on the app.js file, this is only recommended if you do not know the modules used in this block, then a list of the modules:

2- Divide and conquer

Just when the generator asking for something like if you wanna create one folder for something answer yes allway , this way the generator got to split the app in separate folders while generate all.

Setting

This way display all set command that this block have

	yo stack-lego:express set

alt set options

Setting url param

Add param method with the name provide for the user in setting folder or the file app.js .

	yo stack-lego:express set param

alt param set

Setting views

Set one attribute called views in the app object to be used after.

	yo stack-lego:express set view

alt param set

Setting engine

Set one attribute called engine render in the app object to be used after.

	yo stack-lego:express set engine

alt write engine alt set engine

Setting statics files

Set the folder where is you statics file according the path provider for the user relative to the setting folder or the main file app.js

	yo stack-lego:express set static

alt write path

alt statics files

Routes

Generate one route with the method and path providers for the user and one file with the name of the path that contain the class to handler all this thing that route need,in case of user choice not get the setting > route then this will generate in the main file app.js

	yo stack-lego:express route <method in uppercase> <path>

alt write route alt gen route

Too can be used on existing routes, with diferent method alt new method

alt new route

Routes with authentication

	yo stack-lego:express route <method in uppercase> <path> Auth

Add the Auth attribute in the and of command and will generate one route with authenticacion

alt auth

alt set auth

alt auth index

Test

alt post auth

¿ How to run this ?

So easy

	gulp