Your Choice JavaScript News

Node News Monday, February 5 PM

Node News TLDR / Table of Contents

Score: 7062
URL: https://www.sitepoint.com/using-node-mysql-javascript-client/
Tweeted At: Sun Feb 04 08:17:02 +0000 2018
Publish Date: 2018-01-17T22:10:55+00:00
Author:

  • //app.js – – const mysql = require(‘mysql’); – const connection = mysql.createConnection({ – host: ‘localhost’, – user: ‘user’, – password: ‘password’, – database: ‘database = { – if (err) throw err; – the mysql Module – Now let’s take a closer look at each of those steps.
  • Here’s a dump of the database, so that you can get up and running quickly, if you wish to follow along: – CREATE TABLE employees ( – id int(11) NOT NULL AUTO_INCREMENT, – name varchar(50), – location varchar(50), – PRIMARY KEY (id) – ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ; -…
  • con.query(‘SELECT * FROM employees’, (err,rows) = { – if(err) throw err; – – console.log(‘Data received from Db:\n’); – console.log(rows); – }); – – When you run app.js (either using grunt-watch or by typing node app.js into your terminal), you should be able to see the data returned from database logged…
  • [ { id: 1, name: ‘Jasmine’, location: ‘Australia’ }, – { id: 2, name: ‘Jay’, location: ‘India’ }, – { id: 3, name: ‘Jim’, location: ‘Germany’ }, – { id: 4, name: ‘Lesley’, location: ‘Scotland’ } ] – – Data returned from the MySQL database can be parsed by simply…
  • rows.forEach( (row) = { – console.log(`${row.name} is in can execute an insert query against a database, like so: – const employee = { name: ‘Winnie’, location: ‘Australia’ }; – con.query(‘INSERT INTO employees SET ?’

Tags: database, mysql module, mysql client offers, dynamic table creation, usual CRUD operations

Score: 1599
URL: https://medium.com/the-node-js-collection/modernizing-node-js-with-idiomatic-javascript-f18d984dcf93
Tweeted At: Sun Feb 04 23:03:23 +0000 2018
Publish Date: 2018-01-29T17:07:09.090000+00:00
Author: Node.js Foundation

  • In other words, if developers want to improve the performance of their JavaScript, what sort of code should they write?In the past, performance advice was often presented as anti-patterns, for example “Don’t use for-each” or “Don’t use try-catch”.
  • For much of its life, Node.js embedded the V8 engine as the only option to run JavaScript code.
  • Fast-forward to 2018 — Node.js can now also be powered by the ChakraCore JavaScript engine and V8 has a new optimizing compiler Turbofan, both of which have a very different performance profile to Crankshaft.
  • The answer is straightforward: JavaScript developers should focus on writing idiomatic, readable and maintainable code and not focus on the compilers underneath.
  • Ideally, developers should not have to worry about any of those micro-optimizations, instead they should be able to write something much simpler like the following, and trust that the compiler will do the right thing for performance:We believe that instead of developers specializing their JavaScript code for the compilers, compiler…

Tags: JavaScript, developers, code, JavaScript virtual machines, performance

Score: 1056
URL: https://medium.com/@nodejs/how-cond%C3%A9-nast-used-node-js-to-unify-brands-and-create-customer-faith-ace11446c012
Tweeted At: Mon Feb 05 11:56:48 +0000 2018
Publish Date: 2018-02-01T22:28:24.939000+00:00
Author: Node.js Foundation

  • How Condé Nast Used Node.js to Unify Brands and Create Customer FaithCondé Nast is an iconic umbrella company for twenty of the world’s most popular media brands, including Wired, Vogue, and The New Yorker.
  • In 2012, the Condé Nast’s Technology team was faced with a challenge: the different brands were using different systems, tech stacks, and programming languages, a situation that strained the IT teams, both culturally and technically.Back then, like many organizations, Condé Nast operated on the legacy model: frontend and backend engineers,…
  • The mix led to both a cultural disconnect between different groups and between members of any given team.
  • Even with a typical team comprised of only five people, reconciling differences bordered on impossible.The team needed a new solution and eventually came across Node.js.
  • We recently sat down with a few members of the Condé Nast IT team to hear more about why they chose Node.js, how they approached adopting Node.js, and the challenges that they faced along the way.

Tags: Condé Nast, iconic umbrella company, popular media brands, Nast IT team, tech stacks

Score: 660.3
URL: https://www.codejobs.biz/es/blog/2015/08/03/desarrollando-un-proyecto-desde-cero-con-nodejs-angularjs-parte-2
Tweeted At: Mon Feb 05 08:10:08 +0000 2018
Publish Date:
Author: Carlos Santana

  • Hola chicos, seguimos con este gran curso, ahora la parte 2, en la cual van a aprender: – – – Implementar un proxy hacía el dominio studiovictory.com – Agregar archivos de configuración.
  • Integrar el proyecto con PM2 – – –   – – – – VIDEO – – ¿Te perdiste el vídeo anterior?
  • ¿Te gustó esta publicación?

Tags: única forma,

Score: 180
URL: https://habrahabr.ru/post/348332/
Tweeted At: Mon Feb 05 13:37:29 +0000 2018
Publish Date:
Author:

  • При отправке формы делается запрос к api приложения, где хранится токен бота, обрабатываются данные и далее делается запрос к api телеграмма, который отправляет сообщение в чат.
  • Сообщение будет отправляться без перезагрузки страницы, поэтому вешаем обработчик на форму, собираем данные, преобразуем в json и отправляем их асинхронно себе в api + выводим сообщение о статусе formId = ‘telegramForm’ – const form = для захвата данных из тегов формы и синтеза JSON-обьекта – function toJSONString(form) { – var…
  • , – icon: ‘error’, – timer: 2000 – }) – = ‘block’ – = ‘0’ – } – } – //////////////////////////// – //////////////////////////// – ‘application/json’) – //отправляем – formReq.send(json) – }) – } – – Back – На стороне сервера для начала нужно отловить запрос со стороны клиента, для этого…
  • js: – – //Я вынес логику обработки данных в отдельный файл – const ctrlTelegram = = (req, res) = { – //токен и id чата берутся из config.json – const config = let http = require(‘request’) – let reqBody = req.body – //каждый элемент обьекта запихиваем в массив – let…
  • API телеграмма позволяет передать данные посредством текста в адресной строке, поэтому проходим по массиву и создаём длинную строку.

Tags: токен бота, api телеграмма, адресной строке, ник бота должен,

Top Node Courses

The Complete Node.js Developer Course (2nd Edition) (60,232 students enrolled)

By Andrew Mead
  • Build, test, and launch Node apps
  • Create Express web servers and APIs
  • Store data with Mongoose and MongoDB
  • Use cutting-edge ES6/ES7 JavaScript
  • Deploy your Node apps to production
  • Create real-time web apps with SocketIO

Learn more.


Angular (Angular 2+) & NodeJS - The MEAN Stack Guide (26,806 students enrolled)

By Maximilian Schwarzmüller
  • Build real Angular + NodeJS applications
  • Understand how Angular works and how it interacts with Backends
  • Connect any Angular Frontend with a NodeJS Backend
  • Use MongoDB with Mongoose to interact with Data on the Backend
  • Use ExpressJS as a NodeJS Framework
  • Provide a great user experience by using Optimistic Updating on the Frontend
  • Improve any Angular (+ NodeJS) application by adding Error Handling

Learn more.