I am a young dev trying my hands around in different stuff.
So I would appreciate any criticism or comments that would allow me to Learn more :) or good practices I can follow.

Here is one project where I tried to create a structured frameworkish way to write mqtt processors.
Mqtt processors are standalone apps that process mqtt requests that has to be acted upon (like add sensor data to db sent from sensor node, read from db, turn some gpio on or off if the app is on some embedded device like raspi ) etc.
This project creates a structure where you can just focus on writing subscribed topic listeners in a clean neat way. (Hopefully)

  • 2

    Using es5 + commonjs??

    Go google ES6, or better yet check out:

    unless you're forced to maintain legacy code, there aren't really any good reasons for using es5. You'll thank me later.
  • 1
    @rozzzly I am trying to rewrite it in es6. Apparently export and import is not supported in node js 4.5 what do you suggest with commonjs pattern of require()
  • 0
    To get es2015 module import/export syntax working you'll need to add a transformer to your babel config... Which raises the question, have you been introduced to babel yet?

    Go watch a few ~1hr devshop talks about es6 on YouTube to give you some more background info.

    Let me know how you feel after that. If you still are having trouble, I'll fork your repo, set that up for you, and then, PR it.. in like 3 minutes. It's not complex, you just have to do a little research before hand. Perhaps choose a boilerplate repo (google es6 boilerplate). Just try to avoid any one using webpack, don't bigger order more than you can chew just yet.

    Don't get discouraged, it's really not complicated
    You just need to do a fair deal of reading
  • 0
    @rozzzly hey. I installed babel-cli added it to my package.json to transpile my es6 code to es5 into separate folder.
    To do that I use npm build. It then transpiles and outputs to directory I specified.
    I used presets for es2015 in babelrc.

    Am I on right track?
    I checked it worked.
    Thanks for the guidance. It means a lot :)
    (It transpiled but there are some inherent issues with my code because i used commonjs style for core inclusion of call back. But that's a separate issue and I will deal with that by rewriting that logic part.)
  • 1
    Since you're project was pretty small, I definitely suggest just cloning a boilerplate (has everything preconfigured, watch scripts, etc) and just rewriting your code in es6. When I get off work I'll PR something real quick. And I'm glad to help, es6 is annoying to get going, but it sooooooo worth it.
  • 0
    @rozzzly thanks for all the help. I learnt a lot :)
Add Comment