From 42e752b3f5cb05972e361d20309b7418ca09ca6a Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Sun, 3 Nov 2019 00:41:52 +0200 Subject: [PATCH] minor Former-commit-id: c66f17fb0dc5c130e5060bea4cb4f291e031a36c --- .../custom-context/method-overriding/main.go | 2 +- _examples/tutorial/dropzonejs/meta.yml | 4 +- _examples/tutorial/url-shortener/README.md | 2 +- _examples/tutorial/vuejs-todo-mvc/README.md | 110 ++++++++++-------- 4 files changed, 67 insertions(+), 51 deletions(-) diff --git a/_examples/routing/custom-context/method-overriding/main.go b/_examples/routing/custom-context/method-overriding/main.go index 826dcd8f..53a9832c 100644 --- a/_examples/routing/custom-context/method-overriding/main.go +++ b/_examples/routing/custom-context/method-overriding/main.go @@ -70,7 +70,7 @@ func main() { // this will be executed by the MyContext.Context // if MyContext is not directly define the View function by itself. app.Handle("GET", "/hi/{firstname:alphabetical}", recordWhichContextJustForProofOfConcept, func(ctx iris.Context) { - firstname := ctx.Params().Get("firstname") // ctx.Values().GetString("firstname") + firstname := ctx.Params().Get("firstname") ctx.ViewData("firstname", firstname) ctx.Gzip(true) diff --git a/_examples/tutorial/dropzonejs/meta.yml b/_examples/tutorial/dropzonejs/meta.yml index f0815494..8b23e948 100644 --- a/_examples/tutorial/dropzonejs/meta.yml +++ b/_examples/tutorial/dropzonejs/meta.yml @@ -1,8 +1,8 @@ Name: DropzoneJS Articles: - Title: How to build a file upload form using DropzoneJS and Go - Source: https://hackernoon.com/how-to-build-a-file-upload-form-using-dropzonejs-and-go-8fb9f258a991 + Source: https://medium.com/hackernoon/how-to-build-a-file-upload-form-using-dropzonejs-and-go-8fb9f258a991 Author: https://twitter.com/@kataras - Title: How to display existing files on server using DropzoneJS and Go - Source: https://hackernoon.com/how-to-display-existing-files-on-server-using-dropzonejs-and-go-53e24b57ba19 + Source: https://medium.com/@kataras/how-to-display-existing-files-on-server-using-dropzonejs-and-go-53e24b57ba19 Author: https://twitter.com/@kataras \ No newline at end of file diff --git a/_examples/tutorial/url-shortener/README.md b/_examples/tutorial/url-shortener/README.md index b6098c25..842caed1 100644 --- a/_examples/tutorial/url-shortener/README.md +++ b/_examples/tutorial/url-shortener/README.md @@ -1,3 +1,3 @@ ## A URL Shortener Service using Go, Iris and Bolt -Hackernoon Article: https://hackernoon.com/a-url-shortener-service-using-go-iris-and-bolt-4182f0b00ae7 \ No newline at end of file +Hackernoon Article: https://medium.com/hackernoon/a-url-shortener-service-using-go-iris-and-bolt-4182f0b00ae7 \ No newline at end of file diff --git a/_examples/tutorial/vuejs-todo-mvc/README.md b/_examples/tutorial/vuejs-todo-mvc/README.md index 2ba739e9..4de89a39 100644 --- a/_examples/tutorial/vuejs-todo-mvc/README.md +++ b/_examples/tutorial/vuejs-todo-mvc/README.md @@ -1,6 +1,6 @@ # A Todo MVC Application using Iris and Vue.js -## Hackernoon Article: https://twitter.com/vuejsdevelopers/status/954805901789224960 +## Hackernoon Article: https://medium.com/hackernoon/a-todo-mvc-application-using-iris-and-vue-js-5019ff870064 Vue.js is a front-end framework for building web applications using javascript. It has a blazing fast Virtual DOM renderer. @@ -29,9 +29,9 @@ Many articles have been written, in the past, that lead developers not to use a You’ll need two dependencies: 1. Vue.js, for our client-side requirements. Download it from [here](https://vuejs.org/), latest v2. -2. The Iris Web Framework, for our server-side requirements. Can be found [here](https://github.com/kataras/iris), latest v11. +2. The Iris Web Framework, for our server-side requirements. Can be found [here](https://github.com/kataras/iris), latest v12. -> If you have Go already installed then just execute `go get -u github.com/kataras/iris` to install the Iris Web Framework. +> If you have Go already installed then just execute `go get github.com/kataras/iris/v12@latest` to install the Iris Web Framework. ## Start @@ -58,15 +58,24 @@ _Read the comments in the source code, they may be very helpful_ // Full spec-compliant TodoMVC with Iris // and hash-based routing in ~200 effective lines of JavaScript. -var socket = new Ws("ws://localhost:8080/todos/sync"); +var ws; -socket.On("saved", function () { - // console.log("receive: on saved"); - fetchTodos(function (items) { - app.todos = items - }); -}); +((async () => { + const events = { + todos: { + saved: function (ns, msg) { + app.todos = msg.unmarshal() + // or make a new http fetch + // fetchTodos(function (items) { + // app.todos = msg.unmarshal() + // }); + } + } + }; + const conn = await neffos.dial("ws://localhost:8080/todos/sync", events); + ws = await conn.connect("todos"); +})()).catch(console.error); function fetchTodos(onComplete) { axios.get("/todos").then(response => { @@ -95,7 +104,7 @@ var todoStorage = { return; } // console.log("send: save"); - socket.Emit("save") + ws.emit("save") }); } } @@ -259,7 +268,7 @@ window.addEventListener('hashchange', onHashChange) onHashChange() // mount -app.$mount('.todoapp') +app.$mount('.todoapp'); ``` Let's add our view, the static html. @@ -279,9 +288,8 @@ Let's add our view, the static html. - - - + +