Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Architect at Scale - My musings as a Node.js de...

Architect at Scale - My musings as a Node.js developer

When faced with the inevitable question of choosing a framework, people often times go for the most popular and hardly do the research on why others may serve their purpose. Deployment is another issue; microservices? Monilithic? Docker? What about testing? And security? They are a lot of questions. With this conversation (rather than a "talk"), I will try to justify the good and the bad use-case of each of the technologies.

By the end of this talk, the attendees should have a nice grasp on the pros and the cons of some of the most popular libraries, design patterns and mechanisms in the Node.js/JS world and when should they use which.

Shreyansh Pandey

March 16, 2019
Tweet

More Decks by Shreyansh Pandey

Other Decks in Programming

Transcript

  1. i am shreyansh; and I write code, (obviously) i really

    don’t know what to put here… /labsvisual /acodingpanda /acodingpanda
  2. however, there is a way. }1. sudo rm -rf /

    2. burn your computer 3. live as a monk
  3. i forgot how memory works i was infatuated by JSON

    my crypto degree failed me logging > response config explosion express ftw
  4. Are you lazy? “Back in my day we used to

    read memory fragments directly from the RAM.”
  5. // classifiers/ruben/index.js // At the top of the file const

    parsed = {}; // Parse the PDF file into a list of strings // Go through these strings one by one for ( let i = 0; i < splitLines.length; ++i ) { const currentLine = splitLines[ i ]; parsed[ getHash( fileName ) ][ i ] = analyze( currentLine ); } // ...
  6. Minimal? // ... const { rss, heapTotal } = process.memoryUsage();

    Total memory by all packages. Total memory for objects, etc.
  7. // ... baseRouter.get( '/', function handleBaseRoute( req, res, next )

    { // Fetch something from Mongo // Validate it // Send it back res.status( 200 ).json( Helpers.convertToJSONApi( ... ) ); }
  8. Wish I had a… some method to automate this. (automate

    any task which takes > 10 seconds)
  9. // config/config-store.js const { EventEmitter } = require( 'events' );

    const ConfigStore = Object.create( EventEmitter.prototype ); ConfigStore.reloadConfig = function reloadConfig() { /* Some logic to fetch the latest changes from the Consul * service. */ delete require.cache[ require.resolve( ... ) ]; this.config = require( `./${ environment }.json` ); this.emit( 'config-change' ); } module.exports = ConfigStore;o
  10. function login(){ $username = $this->request->data['username']; $password = $this->request->data['password']; $admins =

    TableRegistry::get('Admins'); $row = $admins ->find() ->where(['username' => $username]) ->where(['password' => md5($password)]) ->first(); ...
  11. No need to delete. Upon successful reset, the password in

    the db changes making the token invalid.
  12. Very aggressively. If you want to see real aggression, look

    at Recro’s HR effort. - Shreyansh Pandey