8 ms·
The front end of an example full-stack app built using Vue and Node
- sharemywin 7y agoI didn't get a chance to look deep at your code, but was wondering what your thoughts were about this article on passport best practices: https://hackernoon.com/your-node-js-authentication-tutorial-is-wrong-f1a3bf831a46 https://hackernoon.com/your-node-js-authentication-tutorial-...
- y-c-o-m-b 7y agoNice work! Just goes to show how clean and readable Vue code is. I've done enterprise development with React, Angular, and older stuff like JQuery. Vue is by far my favorite for its ease of us, minimalist footprint, and readability. In a real world situation, I would attach id attributes to the elements for automated QA testing purposes.
- petilon 7y agoI see some worrisome coding patterns here: https://github.com/TahaSh/vue-forum-app/blob/master/src/views/Category.vue https://github.com/TahaSh/vue-forum-app/blob/master/src/view... <base-button v-if="isLoggedIn && currentUser.can('own_topics:write')" class="new-topic-button" :to="{ name: 'CreateTopic' }" > There is logic embedded in the view. Does this get compile-time checked (assuming you used a compiler such as TypeScript)? In my opinion this is the weak-point of Vue. It is possible to use JSX in Vue. But it is also possible to use non-compile-time-checked expressions. In React you only have compile-time-checkable syntax. That's better because when a code is written using React (by someone other than you) you immediately have some reassurance that some poor coding patterns are excluded.
- crooked-v 7y agoJSX with Vue doesn't help that much, since you've still got a lot of this.whatever variables that can't be programatically verified at compile time (AFAIK), unlike Typescript verification of prop usage.
- ratww 7y agoThere are tools that perform type checking in templates: https://github.com/vuejs/vetur/pull/681#issuecomment-363112704 https://github.com/vuejs/vetur/pull/681#issuecomment-3631127... https://github.com/Yuyz0112/vue-type-check https://github.com/Yuyz0112/vue-type-check
- e12e 7y agoI'm hoping "isLoggedIn" / "currentUser.can" is just a convenient shortcut for conditional rendering, and the authorization is handled by the back-end? I'm assuming that is so... Only I've seen some crazy stuff in front-end centric tutorials that seem to assume code injection isn't possible (if by malware or the js console..).
- SheepSlapper 7y agoYou're correct, v-if in Vue is for conditional rendering. If the statement evaluates to false then the button isn't added to the DOM. And you're doubly correct, the back-end better verify those requests as well. Can't trust user input, which includes HTTP requests from client apps...
- esaym 7y ago>There is logic embedded in the view. What logic is that? The v-if part? I've done a few larger vue apps where users have many different permissions. I don't see anything wrong with hiding something on the front end if a user doesn't have the permission. What would the alternative be? I remember the days of handling permissions via HTML templating engines... certainly a simple v-if statement in vue is better than that.
- wiradikusuma 7y agoI've been using React for a year or two, and I thought it's my holy grail for frontend. Few weeks ago a colleague suggested Vue for a project. Initially I was skeptical, but as I learn it, my mind is blown. Esp. look at quasar.dev, it's Vue with batteries included.
- xixixao 7y agoI see a lot of untypeable code (in views). Doesn’t that slow you down whenever you want to make a change in an existing codebase?
- brailsafe 7y agoI feel like what actually gets output to the dom sees more of a benefit from sensible templating than from typability. Can't think of a time in untyped codebases where I thought that was important enough to slow me down. Perhaps it could help in typed codebases though.
- ratww 7y agoIn another comment I linked to some tools that can typecheck views. It is also possible to use JSX. I've found out however that unit testing works fine for those cases.
- RobertRoberts 7y agoThe Quasar site literally made me queasy with the full screen spinning. Can you summarize what it does? The site isn't clear, but it looks interesting.
- erokar 7y agoQuasar is a framework based on Vue that speeds up cross platform development. It lets you build for web, Andriod, iOS (using Cordova) and desktop (using Electron). It comes with a well-documented library of Material design components.
- ergothus 7y ago
- whycombagator 7y agoClicking reply on a topic prompts a login screen to display, if you then click signup it just reloads the topic
- avip 7y agoFriendly suggestion: 1. Add the backend under same repo. 2. Add a root docker-compose.yml instead of sending interested party to "install backend". root | - frontend | - Dockerfile | - ... code | - README.md | - backend | - Dockerfile | - ... code | - README.md | - .gitignore | - README.md | - docker-compose.yml Thanks
- oliv__ 7y agoI agree with suggestion #1 but what do you need to bring docker in for? That's way overkill. Just have the server side serve the Vue.js app on the main route.
- salamander014 7y agoI understand why people think Docker is overkill, but Docker is a simplified approach to the most "correct" way to build and deploy applications we've come up with so far. Even though simple projects don't necessarily need Docker to work, they are 100 times better off using Docker than doing things by hand, because that alternative means they are only deploying once and never again (updates, new environment, dev/staging/prod) and that's just not true.
- dvt 7y agoThis, of course, sounds good in theory, but then you'll realize that Docker itself can break six ways from Sunday. Deployment should not be part of, or in any way linked to, code. I'm not sure why everyone's starting to bundle what is essentially dev-ops infrastructure with source. I have some old laptops where Docker doesn't even work, for example (due to a lack of VT-x). Why should that preclude me from a simple "yarn run" or whatever? It's insanity.
- koboll 7y ago>Deployment should not be part of, or in any way linked to, code. Why?
- thdrdt 7y agoI like Vue a lot, but then I discovered Blazor (.NET core + SignalR). And now I am questioning the whole Javascript ecosystem. With stacks like Vue and Node I always feel I have to do the same work twice. Double models, validation in the front end and validation in the back end, and so on. With frameworks like Blazor you are much more productive. And I believe this will be the future of developing SPAs.
- crtlaltdel 7y ago> And I believe this will be the future of developing SPAs. I think you can substitute Blazor with a large number of frameworks (RoR, Meteor, django, etc) and find a lot of people who believe it is the future of developing SPAs.
- thrownaway954 7y agoTotally agree with you. Blazor is a game changer. I can bet by the end of 2020, Blazor will surpass all the javascript frameworks in adaption.
- mhd 7y agoReminds me a bit of how we thought about Vaadin or GWT...
- sdfin 7y agoApart from using WebAssembly, is Blazor very different in some way from these two?
- mhd 7y agoVaadin is a bit higher level, if I remember correctly. It seems to pivot to work with Web Components these days, some of which might be written in Web Assembly anyway... I don't even think that bytecode->WASM and Java->JavaScript should be that inherently different for frontend purposes. Then again, I never thought we'd need hyper-optimized JIT compilers for friggin' simplistic UIs, where you'd think that Microsoft BASIC would be fast enough... (Sure, it's great for lunning Linux, Quake or Alexa in the browser…) But I'll try not ending up sounding facetious. From a code quality and ease of use POV, Blazor might be better, haven't done too much to argue that. And even rebranding the same technology after a few year's of both Moore's law and lessened expectations by users/developers is often a big difference from a marketing standpoint. And that does count, as it increases the community, which is where a lot of projects fail.
- deltron3030 7y agoIs there a way to make the transitions more snappy, maybe with a less linear transition curve? I suspect that current implementation makes the app feeling slower than it could be.
- thekevan 7y agoWhy is this noteworthy? I'm not saying it isn't at all, but as someone who doesn't do full stack, how is this different than some of the basic app example one may do in a tutorial. I'm sure it's more, it's just not clear to me with my lack of experience in this area.
- ronilan 7y ago> Why is this noteworthy? I'm, obviously, pulling some rabbits out of thin air here but... see this: import Vue from 'vue' Not knowing anything about Vue, you can still guess that Vue is serious magic just by looking at the way the code for the project is laid out. That's it. Ah, but why is it noteworthy? Cause assume, just for a second, you had a private package, that may also be able to pull rabbits out of dark places, and you had reasons to keep it unpublished. Like, you wouldn't want to release the code, not even in bundled apps. In that case, you would look at this HN item, and repo, and note that, yes, one can release code for a magic based app without releasing the code for the magic lib itself. And that this may allow someone at HN to comment Nice work! Just goes to show how clean and readable [insert magic lib name] code is. And this can start a conversation and lead to opportunities. And that's worth noting. But also worth nothing. Cause it's nonsense. You can always do neither. Edit: I’m not saying this is the reason this specific item is on the front page or commenting on the repo itself (the code looks solid). I’m just herding speculative rabbits.
- lucasmullens 7y agoI can't really follow all the rabbits here. Vue is just a library, being used in the same way as any other library.
- ronilan 7y ago>I can't really follow all the rabbits here. I apologize for that. When a rabbit picture is sent over a fax machine, the machine makes a lot of noise. Unfortunately even if one listens intently, one will not be able to see the rabbit. The message still goes through though.
- hit8run 7y agoI prefer Ruby on Rails for these kind of CRUD apps. I see no tests in this repo and the DB also seems mocked?
- Piisamirotta 7y agoIs there a similar for React and Node? Just trying to learn those
- dsego 7y agoTry RealWorld example apps: https://realworld.io/ https://realworld.io/
- Piisamirotta 7y agoThank you!
- cobbzilla 7y agoAs a backend developer who only sometimes (and reluctantly) dabbles in frontend code, I found this example to be much more understandable: https://jasonwatmore.com/post/2018/07/14/vue-vuex-user-registration-and-login-tutorial-example https://jasonwatmore.com/post/2018/07/14/vue-vuex-user-regis... The explanations are great, and the layered structure is nice and clean. I've tried React and the learning curve was just too high for me. Learning Vue has been a joy by comparison.
- deleted 7y ago[deleted]
- BaconJuice 7y agois the auth provided here production ready? what steps do we need to take to make sure it's got prod ready auth?
- harrisonjackson 7y agoNeat minimal app! Each new page loads fast enough for me that the loaders are very jarring. Minimal UI improvement might be to remove the loader and just transition to the view when it is done loading. Show the loader after 200ms or some amount of time if it is taking unexpectedly long.
- deleted 7y ago[deleted]