Node.js data source generator for your Handsontable. Works great with datasource-connector plugin. This generator will generate the express js route (controller) and view (pug) based on communication specification
Steps to install this package
$ npm i handsoncode-apps/datasource-node -gThis example show how to create new express js application with Handsontable spreadsheet in 5 easy steps.
- Create express js app with pug view
$ npm install express-generator -g
$ express --view=pug myapp- Generate Handsontable controller and install corresponding pug view with communication plugin
$ cd myapp
$ datasource-node myController --engine pug --assets private- Install required packages
$ npm install
The generator will create 2 files and download latest assets:
- route/myController.js - communication methods stub
- view/myController.pug - frontend html view and handsontable initalization
- private/css/handsontable.min.css (handsontable css)
- private/js/handsontable.full.js (handsontable js)
- private/js/datasource-connector.full.js (handsontable data REST data source plugin)
- Insert below lines to your app.js just after
var app = express();
const myController = require('./routes/myController');
app.use('/myController', myController);
app.use(express.static('private'));- run server by execute command
$ npm startThe generated project will be on:
http://localhost:3000/myController
$ cd myapp
$ datasource-node myController --engine manualThe generator will create file:
- The route/myController.js with the methods stub
$ cd myapp
$ datasource-node myController --engine manual --assets privateThe generator will create files:
- The route/myController.js with the methods stub And download the latest release version of:
- The ~/assets/js/datasource-connector.full.js
- The ~/assets/js/handsontable.full.js
- The ~/assets/css/handsontable.min.css
This generator will NOT update your app.js file, you need to do it manually (please see the generator output).
In case of assets, remember to add it to your static folder.