Showing posts with label Sails framework v1.0 tutorial. Show all posts
Showing posts with label Sails framework v1.0 tutorial. Show all posts

Jan 17, 2019

SailsJS Generate Report



SailsJS Generate Report :




1. Install NPM Module

Official NPM Link : https://www.npmjs.com/package/pdfmake


npm install pdfmake
2. Copy Font Folder to Your Directory

Download it from here.. Official Repository

https://github.com/bpampuch/pdfmake/tree/master/examples


3. Include the Fonts and Pdfmake Module.

The sample code is given bellow.


Aug 19, 2018

Sails Framework V1.0- Form POST



Sails Framework  V1.0 - Form POST

STEP 1:
a) Generate pages using the command

In the above example foldername is the name of the folder. which will be created under the following locations
i) API
ii) views/pages/
iii) assets/js/pages/
iv) assets/styles/pages/

b) copy the generated routes into routes file.
The above single command will be used to generate files for the following locations.
under i) API folder back end foldername/view-functionname.js file will be created .
ii) views/pages/foldername/functionname.ejs file will be create for html file.
iii)  assets/js/pages//foldername/functionname.js  this file is for javascript operations.
iv) assets/styles/pages/foldername/functionname.less  this file is for css operations.

STEP 2:
a) Create API alone using the command
sails generate auth apifolder/functionname

b) Again copy the generated routes into routes file.
c) create logic for the function example




STEP 3:
a) Run the command to generation post action for form post.
sails run rebuild-cloud-sdk


STEP 4:

a) now look into ii) views/pages/foldername/functionname.js and create a ajax form using the following code.


STEP 5:
a) now look into assets/js/pages//foldername/functionname.js and create the required functions



STEP 6:
a) now look into config/policies.js
check the session validation on the page is authorized to view for the user.


STEP 7:
a) Stop the server once and restart again. Usually it back-end related operations require to restart the server

See this video Tutorial