Blog

Focus returns to server side. To make it easier nodemon was installed a dev dependency with npm install nodemon –save-dev and the start script in package.json has a “start”:”nodemon -w server.js server.js”, added so that changes to server.js restart node.

After that housekeeping, the data was moved to an array in server.js and a route added:

Then either with the browser pointed at http://localhost:3000/api/issues (checking the chromes developer tools set to the network->preview pane) or by using $ curl -s http://localhost:3000/api/issues | json_pp the response can be tested.

Handling a web form with React is very elegant. The deceivingly tricky part is handling the ‘state’ at a parent level, letting the child change it only with a call back. So ‘props’ can go down the chain, not up. “The props are immutable, whereas state is not. Typically state variables are passed down to child components as prop, because the children don’t maintain or modify them ” (vasansr, 1651) Me thinks there be a bit of a learning curve to this declarative programming.

Prototyped a UI for an intranet project linky that makes use of Bootstrap. It makes responsive simple, but not easy. Had it working fine yesterday, then when testing on the iPhone discovered it lost its magic, even thought in the desktop browser it worked as it should when shrunk.

Moral of the story is to make smaller commits to git and test before each, dah.

Then when crazy using the ./mongoimport –file ~/Desktop/JobSpecs170426_1620.json –collection jobspecs –db aes because I used –aesdb instead of –aes, so when doing the queries got nothing, dah. Easy to figure out after taking a long break, got my head in a tight loop.

Using the database shell, mongo, the unindexed searches were lighting fast, true its a tiny data set. Hope to have time for some queries into the sub docs tomorrow.

Got my head around the interplay of 4D’s Object type variables and JSON construction. Succeeded in building a job representation which includes nesting arrays of products and production routing with materials. This will form the basis for the api into the erp.

Although it can be published directly from 4D’s webserver, the plan is to utilize this as a fall back during server or network outages. JSON files of jobs will be triggered by changes at hq and written to a dropbox that Node will watch so new arrivals get inserted into mongodb hosted at the plant. Node will then listen for ajax calls from a single page web app that can stand in for the normal eBag screen. In similar fashion the production schedule can be published.