teleren/devto huggingface dataset:
NodeJS/Express – RestAPI to Upload Multipart File to MySQL using Multer + Sequelize ORM
Tags: node, express, multer, restapi
Published: 2021-05-12 12:03:35

https://grokonez.com/node-js/nodejs-express-restapi-to-upload-multipart-file-to-mysql-using-multer-sequelize-orm

NodeJS/Express – RestAPI to Upload Multipart File to MySQL using Multer + Sequelize ORM

In the tutorial, we show how to build a NodeJS/Express RestAPI to upload Multipart Files/Images to MySQL using Multer middleware and Sequelize ORM.

Related posts:
- <a href="https://grokonez.com/node-js/nodejs-save-file-image-to-mysql-by-sequelize-with-blob-type">NodeJS – Save File/Image to MySQL by Sequelize with BLOB type</a>
- <a href="https://grokonez.com/node-js/multer-build-restapi-to-upload-a-multipartfile-to-nodejs-express">Multer – Build RestAPI to upload a MultipartFile to NodeJS/Express</a>

<!--more-->
<h2>Goal</h2>
<h3>Prerequisites</h3>
- <a href="https://grokonez.com/node-js/nodejs-save-file-image-to-mysql-by-sequelize-with-blob-type">NodeJS – Save File/Image to MySQL by Sequelize with BLOB type</a>
- <a href="https://grokonez.com/node-js/multer-build-restapi-to-upload-a-multipartfile-to-nodejs-express">Multer – Build RestAPI to upload a MultipartFile to NodeJS/Express</a>
<h3>Objective</h3>
In the tutorial, we create a NodeJS project that build RestAPI to upload files/images to MySQL database, see below project structure:

<pre><code class="language-javascript">
/NodeJS-Express-Multer-Upload-MultipartFile-Sequelize-MySQL
	/app
		/config
			db.config.js
			env.js
			upload.config.js
		/controllers
			upload.controller.js
		/models
			img.model.js
		/routers
			upload.router.js
	/node_modules
	/resources
		/static
			/assets
				/uploads /* the folder is used to store uploaded files/images in disk*/
				/tmp /* the folder is used to store files/images which are retrieved from MySQL database*/
	package.json
	server.js
</code></pre>

Using PostMan to make a POST request:

<img src="https://grokonez.com/wp-content/uploads/2018/05/NodeJS-Express-Multer-Upload-MultipartFile-MySQL-Sequelize-upload-from-postman.png" alt="NodeJS-Express-Multer-Upload-MultipartFile-MySQL-Sequelize-upload-from-postman" width="751" height="510" class="alignnone size-full wp-image-12420" />

-> result:

<img src="https://grokonez.com/wp-content/uploads/2018/05/NodeJS-Express-Multer-Upload-MultipartFile-MySQL-Sequelize-saving-to-mysql-table.png" alt="NodeJS-Express-Multer-Upload-MultipartFile-MySQL-Sequelize-saving-to-mysql table" width="745" height="189" class="alignnone size-full wp-image-12422" />
<h2>Practice</h2>
<h3>Setting up NodeJS/Express project</h3>
Create a folder 'NodeJS-Express-Multer-Upload-MultipartFile-Sequelize-MySQL':

More at:

https://grokonez.com/node-js/nodejs-express-restapi-to-upload-multipart-file-to-mysql-using-multer-sequelize-orm

NodeJS/Express – RestAPI to Upload Multipart File to MySQL using Multer + Sequelize ORM
Daily Developer Jokes - Wednesday, May 12, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-05-12 12:00:03

---
title: "Daily Developer Jokes - Wednesday, May 12, 2021"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Wednesday%2C%20May%2012%2C%202021"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12589f412c5.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ Why did the angry function exceed the callstack size?

___A:___ It got into an Argument with itself
 -->
NodeJS/Express – POST/GET to MongoDB using Mongoose – AngularJS + Bootstrap form example
Tags: node, express, angular, bootstrap
Published: 2021-05-12 11:54:00

https://grokonez.com/node-js/nodejs-express-post-get-to-mongodb-using-mongoose-angularjs-bootstrap-form

NodeJS/Express – POST/GET to MongoDB using Mongoose – AngularJS + Bootstrap form example

In the tutorial, we show how to POST/GET form data to/from MongoDB in NodeJS/Express application using Mongoose with AngularJS & Bootstrap view.

Related posts:
- <a href="https://grokonez.com/frontend/nodejs-express-post-get-data-to-from-mongodb-using-mongoose-ajax-jquery-bootstrap-form">NodeJS/Express – POST/GET data to/from MongoDB using Mongoose – Ajax JQuery + Bootstrap form</a>
- <a href="https://grokonez.com/node-js/mongoose-many-to-many-related-models-with-nodejs-express-mongodb">Mongoose Many-to-Many related models with NodeJS/Express, MongoDB</a>

<!--more-->
<h2>Goal</h2>
<strong>Technologies</strong>
– NodeJS/Express
– Mongoose
– MongoDB
– AngularJS
– Bootstrap

We create a NodeJS/Express project as below structure:

<pre><code class="language-javascript">
/NodeJS-Express-AngularJS-Bootstrap-MongoDB
	/app
		/config
			mongodb.config.js
		/controllers
			user.controller.js
		/models
			user.model.js
		/routes
			user.route.js
	/node_modules
	/resources
		/static
			/js	
				controller.js
	/views
		404.html
		index.html
	app.js
	package.json
</code></pre>

Run above project then makes POST/GET requests, results:

-> Bootstrap view:

<img src="https://grokonez.com/wp-content/uploads/2018/05/NodeJS-Express-AngularJS-Bootstrap-POST-GET-form-data-MongoDB-view.png" alt="NodeJS-Express-AngularJS-Bootstrap-POST-GET-form-data-MongoDB-view" width="565" height="533" class="alignnone size-full wp-image-12219" />

-> MongoDB’s collections:

More at:

https://grokonez.com/node-js/nodejs-express-post-get-to-mongodb-using-mongoose-angularjs-bootstrap-form

NodeJS/Express – POST/GET to MongoDB using Mongoose – AngularJS + Bootstrap form example
Uploading to S3 using NestJs
Tags: nestjs, awss3, fileupload
Published: 2021-05-12 11:52:55

Gone are those days when we used to store images on our servers. Nowadays we have dedicated image servers for that purpose like AWS S3, Cloudinary, and more. The reason it's better to store on these specialized servers is because of the inbuilt image manipulation tools they come with. They can resize, add watermarks and do much more. 

Here is a simple way to upload files to AWS S3 using NestJs. 
1. You will have to create a bucket on S3 for this first. A bucket is like a folder for your stuff. 
2. You will need the [aws-sdk](https://www.npmjs.com/package/aws-sdk) package from npm for this.
3. Get the ACCESS_KEY and KEY_SECRET from aws.
4. Create a service file so that it can be injected everywhere on demand.
5. Keep all your confidential keys in your .env file.

```
import { Injectable, Req, Res } from '@nestjs/common';
import * as AWS from "aws-sdk";

@Injectable()
export class S3Service
{
    AWS_S3_BUCKET = process.env.AWS_S3_BUCKET;
    s3 = new AWS.S3
    ({
        accessKeyId: process.env.AWS_S3_ACCESS_KEY,
        secretAccessKey: process.env.AWS_S3_KEY_SECRET,
    });

    async uploadFile(file)
    {
        const { originalname } = file;
        
        await this.s3_upload(file.buffer, this.AWS_S3_BUCKET, originalname, file.mimetype);
    }

    async s3_upload(file, bucket, name, mimetype)
    {
        const params = 
        {
            Bucket: bucket,
            Key: String(name),
            Body: file,
            ACL: "public-read",
            ContentType: mimetype,
            ContentDisposition:"inline",
            CreateBucketConfiguration: 
            {
                LocationConstraint: "ap-south-1"
            }
        };

        console.log(params);
        
        try
        {
            let s3Response = await this.s3.upload(params).promise();

            console.log(s3Response);
        }
        catch (e)
        {
            console.log(e);
        }
    }
}

```

A couple of points to look out for here are - ACL which makes your file readable to the public. Else AWS shows "Access Denied". ContentDisposition: "inline" and ContentType - so that your file is viewed by the browser and not downloaded. 

And the response structure looks like this 

```
{
  ETag: '"<unique-key>"',
  Location: 'https://<bucket>.s3.amazonaws.com/<filename>',
  key: '<filename>',
  Key: '<filename>',
  Bucket: '<bucket>'
}
```
The location key is what you want. 


Happy programming!!!
NodeJS/Express – POST/GET to MySQL using Sequelize – AngularJS + Bootstrap form example
Tags: node, express, mysql, sequelize
Published: 2021-05-12 11:42:13

https://grokonez.com/node-js/nodejs-express-post-get-to-mysql-using-sequelize-angularjs-bootstrap-form

NodeJS/Express – POST/GET to MySQL using Sequelize – AngularJS + Bootstrap form example

In the tutorial, we show how to POST/GET form data to/from MySQL in NodeJS/Express application using Sequelize with AngularJS & Bootstrap view.

Related posts:
- <a href="https://grokonez.com/node-js/nodejs-express-save-form-data-to-mysql-using-sequelize-orm-ajax-jquery-bootstrap-view">NodeJS/Express – POST/GET form data to MySQL using Sequelize ORM – Ajax JQuery + Bootstrap view</a>

<!--more-->
<h2>Goal</h2>
<strong>Technologies</strong>

– NodeJS/Express
– Sequelize
– MySQL
– AngularJS
– Bootstrap

We create a NodeJS/Express project as below structure:

<pre><code class="language-javascript">
/NodeJS-Express-Angular-Bootstrap-MySQL
	/app
		/config
			env.js
			db.config.js
		/controllers
			user.controller.js
		/models
			user.model.js
		/routes
			user.route.js
	/node_modules
	/resources
		/static
			/js	
				controller.js
	/views
		404.html
		index.html
	server.js
	package.json
</code></pre>

Run above project then makes POST/GET requests, results:

-> Bootstrap view:

<img src="https://grokonez.com/wp-content/uploads/2018/05/NodeJS-Express-AngularJS-Bootstrap-Sequelize-MySQL-POST-GET-views.png" alt="NodeJS-Express-AngularJS-Bootstrap-Sequelize-MySQL-POST-GET-views" width="416" height="532" class="alignnone size-full wp-image-12229" />

More at:

https://grokonez.com/node-js/nodejs-express-post-get-to-mysql-using-sequelize-angularjs-bootstrap-form

NodeJS/Express – POST/GET to MySQL using Sequelize – AngularJS + Bootstrap form example
Why you should free your developers from handling customer support
Tags: webdev, customersupport, productivity, discuss
Published: 2021-05-12 11:40:55

Are the developers in your company responsible for providing customer support besides their core (development) responsibilities?
Should they really be?

Keep your software engineers away from customer support to:
💡 Meet the growing customer needs.
💡 Decrease response time.
💡 Maintain developer morale.
💡 Reduce project interruptions.
💡 Establish an expert and fully independent support team.

[Read the full article](https://uibakery.io/post/why-not-inolve-developers-in-customer-support?utm_campaign=ui_bakery%20-%20article%20-%20blog%20-%20cacq%20-%20developers_customer_support%20-%20views&utm_source=DevTo&utm_medium=webdev&utm_content=article_announce)
CIAM: Balancing Security with Customer Experience
Published: 2021-05-12 11:35:54

### A robust CIAM solution helps you find the right balance of security without sacrificing customer experience
![CIAM](https://images.ctfassets.net/23aumh6u8s0i/2opPstgbMTWBqurQhYT22U/fbe55b99b77219db5cee29b29972a62a/CIAM_recorte1.png)
### <br>
A recent PwC study found that [32% of the public will abandon a company](https://www.pwc.com/us/en/advisory-services/publications/consumer-intelligence-series/pwc-consumer-intelligence-series-customer-experience.pdf) after a single bad customer experience. What if that frustrating experience is your login? If you turn up the security measures too high, customers won’t bother navigating the hurdles to create an account or log in to an existing one. The flip side is if you dial the security down too far in favor of an easy login flow, malicious actors will take advantage of the fact that while the majority of people (91%) know reusing passwords is a bad practice, [66% admit to doing it anyway](https://www.logmeininc.com/newsroom/press-release/2020/lastpass-psychology-of-passwords-report-reveals-91-of-people-know-password-reuse-is-insecure-yet-two-thirds-do-it-anyway). Those numbers are courtesy of a study conducted by LogMeIn, makers of the password manager LastPass.

Login pages are often the first point of interaction between customers and the companies they do business with. Of course, that means those login pages are often the first point of contact for malicious actors, as well. For any company doing business online, there’s a line to walk between keeping data secure and providing a low-friction login experience for legitimate customers. [Customer Identity and Access Management (CIAM)](https://auth0.com/blog/what-is-ciam/) is the solution that allows for successful navigation of this line.

From a business standpoint, having too few security measures leaves you open to regulatory penalties should a data breach occur and the high financial costs of recovering from a breach, not to mention the damage to your brand that can extend far beyond the recovery period. Too much security can result in lost conversions when customers abandon the process due to friction. A strong CIAM solution lets you consolidate the onboarding, organizing, and managing of user accounts — all while helping mitigate the chances of a breach with defensive measures like Bot Detection and brute force protection.



[Read more...](https://auth0.com/blog/ciam-balancing-security-with-customer-experience/?utm_source=content_synd&utm_medium=sc&utm_campaign=ciam)
[slackbot] aws lambda 로 python 자동화 코드 실행하기
Published: 2021-05-12 11:32:54

*python 코드에 대한 설명은 
[이전 게시물] (https://dev.to/syan/slackbot-setting-2d2o)에서 작성되어 생략합니다.*

#1. aws lambda 환경 만들기
> aws lambda 란?
- Amazon에서 제공하는 서버를 프로비저닝하거나 관리하지 않고도 코드를 실행할 수 있게 해주는 서버리스(serverless) 컴퓨팅 서비스입니다.


###1) 함수 생성
aws lambda 메뉴에 접근 후 함수 생성 클릭
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u15ms5g6fgh26nn5ng0a.png)

###2) 함수 이름 입력 및 언어 선택
원하는 함수이름을 입력하고, 함수를 작성하는 데 사용할 언어를 선택
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kn8efty7z8k0stdp83qq.png)

###3) 함수 환경 확인
함수를 생성이 완료되어 lambda 메인 화면을 확인함
lambda function (python : lambda_function.py) 파일이 생성됨
- [코드] 메뉴에서 코드를 작성하고 수정 및 배포할 수 있음
- [테스트] 메뉴에서 함수를 호출하여 실행한 결과를 확인할 수 있음

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b1l0v29ygvhctus3br0t.png)

###4) 테스트 이벤트 환경 구성
코드 메뉴에서 테스트 및 이벤트 환경을 구성하여 빠르게 이벤트 실행이 가능함
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vwvt2reknspvbwztn9vd.png)
 
###5) 테스트 실행 결과 확인
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ns4wxf2czglcchsfm2o2.png)
 
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ivt2jfgpvvonhalqlz8.png)
 
 

#2. python 코드로 slack에 메세지 전송하기
> 생성된 lambda function 및 구성 환경에 python코드를 작성하여 slack 채널로 메세지를 전송한다.

###1) slack_sdk 파일 업로드
slack_sdk 모듈을 import 해서 사용해야 하기 때문에
로컬에 다운로드한 slack_sdk 소스코드를 lambda에 업로드가 필요함
.zip 파일 업로드 기능을 이용하여, slack_sdk 소스코드를 압축하여 업로드
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dgq0jpw7sb5rxh0nf1iu.png)

###2) slack_sdk 업로드 확인
소스코드들이 업로드 되어 왼쪽 파일 트리 내 코드 확인이 가능함
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/00kbtd5h1wlg3iw6pl3x.png)
 
###3) python 실행
업로드한 slack_sdk 소스코드를 포함하여, 필요한 python 코드를 작성하고 실행
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v8bnjeufhg6thiehrp2i.png)

###4) 실행
작성한 스크립트 파일을 실행하면, slack으로 작성된 코드가 전달되는 것을 볼수 있다.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gvwa7gx4s3ouxd36nga3.png)

#3. cron 스케줄링 작성
###1) 트리거 추가
트리거 추가 기능을 이용하여 스케줄링 가능
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v3znsec8kc4q1ck9lnee.png)
 
###2)EventBridge(CloudWatch Events) 이벤트 트리거 구성
만들어진 lambda 함수를 정해진 시간에 자동으로 원하는 명령이 실행될 수 있도록 트리거를 추가
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c3js3ubvzonhkpnb0qv1.png)

###3) 트리거 규칙 설정
cron(분 시간 일 월 요일 년)의 형식에서 원하는 시간을 설정
시간이 UTC시간이라 한국 시간으로 하기 위해서는 "한국시간 - 9시간"으로 작성
아래 사진은 매 2분마다 알람이 오도록 설정
 ![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4gj5seqhc8nfke8tcdvg.png)

###4) 트리거 추가 완료
트리거가 추가로 인해 정해진 시간에 실행되어 알람이 오도록 가능함
원하는 트리거 설정으로 변경하여 사용 가능함
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cgq1lj1l5cz6ri3fdxe3.png)
 
###5) 자동 실행 
2분마다 실행되도록 설정 된 것을 확인함
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/viiid7854yw5rjfy9jof.png)
JavaScript Chapter 1 - Understanding and Introduction of JavaScript
Tags: javascript, beginners, tutorial
Published: 2021-05-12 11:16:43


- In this tutorial, I will explain about the basics of JavaScript.

## Definition
**JavaScript** is a programming language that is useful for making interactions on websites. So that the website looks more alive. For example, create effects on the website. JavaScript has become one of the mandatory programming languages ​​and must be mastered to create a modern website. JavaScript is a requirement and programming language that must be mastered. Especially for those of you who will specialize in the web design section. The several programming languages ​​that a web developer must master are:
* HTML: In building a website, HTML acts as a form creation.
* CSS: In building a website, CSS has a role as a benthic design, color, writing and so on.
* JavaScript: In building a website, JavaScript is useful for creating features and effects that make website pages more interactive.

## BACKGROUND
In today's developing world of websites, javascript is a programming language that is needed. Many websites use javascript to create dialog modal, form validation, games, ajax calculation operations and so on. So we must master this javascript so that the website we create is more alive
Examples of websites that use javascript to make their website more interactive are Google, Facebook, Twitter and others. One of the uses of javascript on Facebook is that Facebook has a chat box feature that we can close and open. The chat form can be opened and closed because it uses javascript assistance. Then if you buy a plane ticket through the airline ticket provider website. after you select the current city and select the destination city, the airline will appear without reloading the page. Those are some examples of using Javascript

##   Purpose and Objectives
Javascript is a programming language that must be mastered by web developers because javascript has features that are not shared by other programming languages. So those of us who want to become web developers are obliged to learn this javascript so that the website we create will have a lively or interactive impression.
**WHAT CAN JAVASCRIPT DO?** To further emphasize understanding of javascript, the following will explain what javascript can do : 
-   Javascript dapat mengganti atribut HTML
-   Javascript dapat mengganti style CSS
-   Javascript dapat membuat form validasi
-   Javascript dapat membuat sebuah game sederhana
-   Javascript memiliki fitur animasi yang lebih lengkap dan bagus daripada bahasa pemrograman lainya

And there is much more that javascript can do which we will discuss in this Javascript Tutorial topic.

## KESIMPULAN
With this javascript, we can make our website look more lively or interactive. Even though the javascript language is a bit difficult to understand, this programming language has a big role to play in making an interactive website but in my opinion it is not obligatory to add this programming language to your website, but to make it more interactive I suggest adding this programming language.
The Biggest Mistakes I Made When Learning Vim
Tags: vim, productivity, linux
Published: 2021-05-12 11:15:01

[Vim](https://www.vim.org/) is a **powerful editor** available for Linux, OSX and Windows that allows you to edit your code quickly and efficiently. This post is based on my experience from using Vim as a primary editor. 

If you’re reading this, you probably know (or are aware of) vim, the versatile text editor that has been around since the late 1980s. Vim has a reputation for being difficult to learn, but I’m here to tell you that’s not the case. 

While it’s true that vim offers a lot of functionality and operates in a non-standard way, once you understand its “mindset”, it’s a breeze to use.

* **Leaving out practice:** :racehorse:

I didn't bother to practice too much, because I thought I was at least close enough to be productive. This turned out to be very wrong. 

I'm not saying that you could be productive right away, but you need to put in some serious time to tune your muscle memory, or you won't be able to do the things you want to be able to do in a few months.

So why do so many people have difficulty learning vim? In my experience, they use guides to learn it instead of exercises.

If you want to learn Vim fast, I recommend [this tutorial](https://vim.is/)

* **Thinking it works like nano/pico** :monkey_face:

I remember when I first started out with Vim, everything was so alien. I couldn’t even figure out how to exit it (with `ZZ` or `:q!`) for the first week! I made a lot of assumptions that turned out to be wrong, and these incorrect assumptions caused me to make terrible mistakes when learning Vim.

![vim](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i1t9ukqcloyi74clwa8q.png)

When it comes to being productive in vim , the first thing you're going to want to learn is the basic navigation and commands. This is the bread and butter of what you're going to be doing most often, so it's important that you get this right off the bat. With vim, you can't skip this

* **Trying to be productive right away** 

To master vim, you have to invest some time to learn it. Vim can increases your productivity once you mastered the commands. But if you try to skip the learning step, you'll find yourself struggling on the keyboard trying to get simple tasks done. 

![productivity vim vs others](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nyddw8dvulzd5cazj3by.jpg)

Once you learned vim, you can use it inside the terminal on all operating systems, inside your IDE, inside your web browser using extensions etc. 

One of the great things about vim is that it can increase your productivity and it can be used in all systems and interfaces: the terminal and the GUI and even remotely on other computers.