This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new HtmlWebpackPlugin({ | |
template: path.resolve(root, 'src/index.html'), | |
hash: true, //them thẻ <script> với đường link đính kèm 1 mã hash | |
cache: true, //cache file nếu có ko co thay đổi thì ko bundle lại | |
showErrors: false, //neu co loi sẽ ghi vào file html | |
minify: false, //false: ko minify html ngước lại tru: minify html | |
filename: 'index.html', | |
favicon: 'src/favicon.ico', //them file favicon vào trang html | |
/*nạp các nhánh javascript bundle vào file html*/ | |
chunks: ['app', 'publicJS/ex-common', 'publicJS/ex2', 'publicJS/ex1', 'app-home'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sử dụng với 1 loader: loader (sử dụng query parameter) | |
{ | |
test: /\.(png|jpg)$/, | |
loader: 'url-loader?name=[path][name].[ext]&limit=10240' | |
} | |
// Sủ dụng với nhiều loader trong 1 lần load ví dụ: loaders | |
{ | |
test: /\.css$/, | |
// loader: extractCSS.extract(["css"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loaders: [ | |
/*loader css*/ | |
{ | |
test: /\.css$/, | |
exclude: /node_module/, | |
loader: 'style-loader!css-loader' | |
}, | |
/*loader babel transform es6 => es5*/ | |
{ | |
test: /\.js$/, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"build": "webpack --process --color --config webpack.config.prod.js", | |
"dev": "webpack-dev-server --inline --process --color --config webpack.config.dev.js" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let webpack = require('webpack'); | |
// import module cùng các plugin phục vụ cho webpack và webpack-dev-server | |
module.exports = { | |
/*entry: nới nạp các file cần xử lý, hay còn gọi là nơi tình yêu bắt đầu*/ | |
entry: { | |
app: './client/sources/app.js' | |
}, | |
/*output: Nơi tình yêu kết thúc, các file được xuất ra*/ | |
output: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SHOW VARIABLES LIKE 'validate_password%'; | |
+--------------------------------------+--------+ | |
| Variable_name | Value | | |
+--------------------------------------+--------+ | |
| validate_password_dictionary_file | | | |
| validate_password_length | 8 | | |
| validate_password_mixed_case_count | 1 | | |
| validate_password_number_count | 1 | | |
| validate_password_policy | MEDIUM | | |
| validate_password_special_char_count | 1 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router.get('/create-link', function (req, res) { | |
let domain = "http://localhost:82"; | |
let dataExcel = []; | |
User.find({}) | |
.then(users => { | |
let demo2 = []; | |
Object.keys(users[0]['_doc']).forEach(key => { | |
"use strict"; | |
demo2.push(key); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let express = require('express'); | |
let router = express.Router(); | |
let nodeXlsx = require('node-xlsx'); | |
let User = require('./model/user.model'); | |
let fs = require('fs'); | |
/* GET home page. */ | |
router.get('/', function (req, res) { | |
res.render('index', {title: 'Express'}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "excel_node_sample", | |
"version": "0.0.0", | |
"private": true, | |
"scripts": { | |
"start": "node ./bin/www" | |
}, | |
"dependencies": { | |
"ejs": "^2.5.6", | |
"express": "^4.15.3", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model | |
--user.model.js // model User sử dụng để query với mongoose | |
--init.js // Khởi tạo một số dữ liệu user để tiện cho export data | |
public | |
exports | |
--file_excel_export.xlsx // lưu trữ file excel được export | |
view | |
--index.ejs // Trang chủ | |
--receive.ejs // Trang nhận liên kết link download từ server gửi về và hiển thị lên | |
-app.js // cấu hình ứng dụng |
NewerOlder