diff --git a/frontend/vueJS/vue-demo.md b/frontend/vueJS/vue-demo.md new file mode 100644 index 0000000..59e087b --- /dev/null +++ b/frontend/vueJS/vue-demo.md @@ -0,0 +1,385 @@ +# [Tutorial](https://medium.com/sicara/a-progressive-web-application-with-vue-js-webpack-material-design-part-1-c243e2e6e402) vue pwa + +* Vue PWA template is built on top of Vue webpack template +* Webpack is a modern and powerful module bundler for Javascript application +* Project layout + * build: webpack and vue-loader configuration files + * config: app config (environments, parameters) + * src: application source code + * statis: images, css & other public assets + * test: unit test files (Karma & Mocha) + + + +```sh +$ npm install -g vue-cli + +// use pwa template to scaffold a project +$ vue init pwa cropchat + +$ cd cropchat +$ npm install +$ npm run dev + +// launch browser at http://localhost:8080 + +``` + +* Vue pwa template provide default `static/manifest.json`. Edit it to customize the project + +```json +{ + "name": "cropchat", + "short_name": "cropchat", + "icons": [ + { + "src": "/static/img/icons/cropchat-icon-64x64.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/static/img/icons/cropchat-icon-128x128.png", + "sizes": "128x128", + "type": "image/png" + }, + { + "src": "/static/img/icons/cropchat-icon-256x256.png", + "sizes": "256x256", + "type": "image/png" + }, + { + "src": "/static/img/icons/cropchat-icon-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "start_url": "/", + "display": "fullscreen", + "orientation": "portrait", + "background_color": "#2196f3", + "theme_color": "#2196f3" +} +``` + + + +* `index.html` already provide the manifest link + +```html +... + + +... + + + +``` + +## Access from mobile + +* use `ngrok` to forward internet address to localhost host + +```sh +$ npm install -g ngrok + +$ ngrok http 8080 + +``` + + + +```text +ngrok by @inconshreveable (Ctrl+C to quit) + +Session Status online +Version 2.1.18 +Region United States (us) +Web Interface http://127.0.0.1:4040 +Forwarding http://5ef29506.ngrok.io -> localhost:8080 +Forwarding https://5ef29506.ngrok.io -> localhost:8080 + +Connections ttl opn rt1 rt5 p50 p90 + 39 3 0.01 0.01 120.01 881.89 +``` + + + +* Access `https://5ef29506.ngrok.io` from mobile + +## Develop Vue [App](https://medium.com/sicara/a-progressive-web-application-with-vue-js-webpack-material-design-part-1-c243e2e6e402) + +* `src/components/HomeView.vue` + +```vue + + + + + + +``` + + + +* `src/components/DetailView.vue` + +```vue + + + + + +``` + +* `src/components/PostView.vue` + +```vue + + + + + +``` + +* Update `src/router/index.js` + +```js +import Vue from 'vue' +import Router from 'vue-router' +import HomeView from '@/components/HomeView' +import DetailView from '@/components/DetailView' +import PostView from '@/components/PostView' + +Vue.use(Router) + +export default new Router({ + routes: [ + { + path: '/', + name: 'home', + component: HomeView + }, + { + path: '/detail/:id', + name: 'detail', + component: DetailView + }, + { + path: '/post', + name: 'post', + component: PostView + } + ] +}) +``` + +* Remove `Hello.vue` + +### Layout Design + +* install material Design + +```sh +$ npm install material-design-lite --save +``` + +* Update `src/App.vue` + +```vue + + +``` + +* Add Navigation Bar. Update `src/App.vue` template + +```vue + +``` + +* Hide burger menu upon click menu link + +```vue + +``` + +* Populate views +* Create `src/data.js` + +```js +export default { + pictures: [ + { + 'id': 0, + 'url': 'https://25.media.tumblr.com/tumblr_m40h4ksiUa1qbyxr0o1_400.gif', + 'comment': 'A cat game', + 'info': 'Posted by Kevin on Friday' + }, + { + 'id': 1, + 'url': 'https://25.media.tumblr.com/tumblr_lhd7n9Qec01qgnva2o1_500.jpg', + 'comment': 'Tatoo & cat', + 'info': 'Posted by Charles on Tuesday' + }, + { + 'id': 2, + 'url': 'https://24.media.tumblr.com/tumblr_m4j2atctRm1qejbiro1_1280.jpg', + 'comment': 'Santa cat', + 'info': 'Posted by Richard on Monday' + }, + { + 'id': 3, + 'url': 'https://25.media.tumblr.com/tumblr_m3rmbwhVB51qhwmnpo1_1280.jpg', + 'comment': 'Mexico cat', + 'info': 'Posted by Richard on Monday' + }, + { + 'id': 4, + 'url': 'https://24.media.tumblr.com/tumblr_mceknxs4Lo1qd477zo1_500.jpg', + 'comment': 'Curious cat', + 'info': 'Posted by Richard on Monday' + } + ] +} +``` + +* Update `src/components/HomeView.vue` to display mocked data + +```vue + +``` + +* Update temple ans style + +```vue + +... + +``` + diff --git a/redis/README.md b/redis/README.md index 1db2afc..0e759c4 100644 --- a/redis/README.md +++ b/redis/README.md @@ -29,10 +29,18 @@ ```sh 127.0.0.1:6379> set keyname 1 - // set "session_" (base64) key using for authentication - 127.0.0.1:6379> set c2Vzc2lvbl83ZDNlYjNiYS0zYjliLTQyMGEtYTc4YS1lOGQwYzJmY2MzYWVfU2luZ2Fwb3Jl 1 + // set "session_" key using for authentication + 127.0.0.1:6379> set session_337fa7c2-8ce2-422f-a335-57569dd7407b_Singapore 1 ``` -* \ No newline at end of file +* set otp + +```sh +set otp_6591808370_signIn 123456 +``` + +* [MD5](https://www.md5hashgenerator.com/) signature of payload + * security token : c67a06a1-257f-4187-8f7c-6bf1a3d745dc +