nodejs_NodeJS历险记

nodejs

by Elliott McNary

埃利奥特·麦克纳里(Elliott McNary)

NodeJS历险记 (Adventures in NodeJS)

I built an app a couple of weeks ago after going through FreeCodeCamp’s Front-End curriculum and wanted to write an update as I head into NodeJS-land. I was finally able to obtain my Front-End certificate, which I am very proud of, but the excitement quickly wore off once I jumped into the backend side of things.

在经历了FreeCodeCamp的前端课程之后,几周前,我构建了一个应用程序,并想在进入NodeJS领域时编写一个更新。 我终于能够获得我的骄傲的前端证书,但是当我跳入后端时,兴奋很快就消失了。

Learning NodeJS has been incredibly difficult so far. There’s no point in trying to sprinkle it with fairy dust. The move from the front-end of primarily using JQuery and some basic JS techniques, to the backend with plain ol’ Javascript and hundreds of callbacks showed me that I had no clue what I was doing.

到目前为止,学习NodeJS非常困难。 试图撒上仙尘没有任何意义。 从主要使用JQuery和一些基本JS技术的前端到使用普通Java脚本和数百个回调的后端,这向我表明我不知道自己在做什么。

NodeJS requires a fundamental understanding of Javascript. I definitely didn’t have that when I started trying to learn it. I had to go back to watching hours of YouTube videos explaining callbacks, the event loop, closures, scope, etc…

NodeJS需要对Java语言有基本的了解。 当我开始尝试学习它时,我绝对没有。 我不得不回头看几个小时的YouTube视频,讲解回调,事件循环,关闭,作用域等…

I started to get a fair amount of understanding, but would still get lost after tons of callbacks. I was using learnyounode and couldn’t even get past the first problem without looking for a solution.

我开始获得相当多的了解,但是在大量回调之后仍然会迷失。 我使用的是learningyounode,即使没有寻找解决方案也无法解决第一个问题。

I started consuming an incredible amount of MEAN Stack tutorials to try and get the basic ideas of using Express for routing and Node. I built no less than 4 different To-Do apps, 2 reddit clones, 1 Twitter clone, and 2 chat apps, before I realized I wasn’t really absorbing what was going on. I definitely wasn’t mindlessly following instructions, but they assumed I knew too much about Javascript.

我开始使用大量的MEAN Stack教程,试图获得使用Express进行路由和Node的基本思想。 在我意识到自己并没有真正吸收正在发生的事情之前,我构建了不少于4种不同的To-Do应用,2个reddit克隆,1个Twitter克隆和2个聊天应用。 我绝对不会盲目地遵循说明,但是他们认为我对Java语言了解太多。

I started watching a series on TheNewBoston’s YouTube channel that really helped me get the fundamentals down. I was going to try and make another reddit clone, until I realized that I should learn with something I care about, the Soundcloud queue app I built.

我开始在TheNewBoston的YouTube频道上观看系列节目,这确实帮助我降低了基本面。 我打算尝试制作另一个Reddit克隆,直到我意识到我应该学习自己关心的东西,即我构建的Soundcloud队列应用程序。

I stopped watching things and started reading through documentation. I followed getting started tutorials to try and understand the fundamentals a bit more.

我不再看东西,而是开始阅读文档。 我按照入门教程进行操作,以尝试进一步了解基础知识。

I’ve frequently talked about the feeling of getting something to “click” when programming, and this time I had the same feeling. It’s a time you’ll never forget because your adrenaline is pumping and you can see some light. When I was able to setup my first database with key-value pairs, have events push things to the database, and then send the JSON to a route that I made was incredible. It was late and I was fist pumping around my room like a lunatic.

我经常谈论在编程时让某些东西“点击”的感觉,而这次我有同样的感觉。 这是一个您永远不会忘记的时刻,因为肾上腺素不断增加,您可以看到一些光线。 当我能够使用键值对设置我的第一个数据库时,让事件将事件推送到数据库,然后将JSON发送到我创建的路由中是不可思议的。 已经很晚了,我拳头像疯子一样在房间里抽水。

From there I started to gain some confidence and kept pushing myself. I worked on finding, sorting, and incrementing my existing documents in MongoDB. I realized I wanted a live feed so I started looking into Socket.io.

从那开始,我开始获得一些信心,并不断地推动自己。 我致力于在MongoDB中查找,排序和增加现有文档。 我意识到我想要直播,所以我开始研究Socket.io。

I think the problem with the tutorials I was consuming before, was that I never really learned why I was doing things. I was always just doing them and not really thinking about it. It’s incredibly important to know why you’re doing what you’re doing.

我认为我以前使用的教程的问题在于,我从来没有真正了解过为什么要做事情。 我一直只是在做它们而没有真正考虑它。 要知道为什么要做什么,这非常重要。

Instead of googling something that started with “How do I…”, I started searching for the why and trying to figure out what’s actually going on. My searches started to look more like “What is a refresh token in OAuth?” or “What does serialize and deserialize do in Passport.js?”.

我没有去搜索以“我如何……”开头的内容,而是开始寻找原因并试图弄清实际情况。 我的搜索开始看起来更像“什么是OAuth中的刷新令牌?” 或“在Passport.js中序列化和反序列化做什么?”。

When I made that switch I really started to learn.

当我做出切换时,我真的开始学习了。

It’s also very important to keep pushing yourself. If you have something that you want to make, build it. There is always a way to do something, it’s just up to you to figure out (unless of course it’s an API limitation or something…then you just need to get a bit hack-y :). If you don’t know how to authenticate users, try to learn. If you don’t know how to create an RESTful API, learn! It’ll take a ton of time, but once it clicks you’ll be ecstatic.

不断自我推销也很重要。 如果您有想要制作的东西,请构建它。 总是有一种方法可以完成某件事,这取决于您自己决定(除非它是API限制之类的东西,否则……您只需要稍微加点子就可以了:)。 如果您不知道如何认证用户,请尝试学习。 如果您不知道如何创建RESTful API,请学习! 这将花费大量时间,但是一旦点击,您就会欣喜若狂。

I was so in the zone last Sunday I was working until 5am when the Seahawks started playing here in Melbourne. It was a 14 hour coding-binge. I’ve really never had that much enjoyment and focus with anything before. It was a crazy feeling.

上周日,我一直在该区域工作,直到海鹰队在墨尔本开始比赛的凌晨5点为止。 这是一个14个小时的编码过程。 我以前从未真正享受过如此多的乐趣和关注。 这是一种疯狂的感觉。

I’ve finally figured out (well sort of) how to deploy this with Heroku and it’s live. There is now a feed showing the songs that are being queued on the site, as well as a live artist feed in the top right showing the artists being searched now across the site. I have also implemented a Top 10 ranking for the Top 10 songs queued all time (well, since launching the feature).

我终于弄清楚了(如何进行)如何在Heroku中部署它,并且它是实时的。 现在有一个提要,显示正在网站上排队的歌曲,右上角还有一个现场艺术家提要,显示了现在正在站点上搜索的艺术家。 我还为所有一直排队的前10首歌曲实现了前10名的排名(自启动此功能以来)。

The Random 20 is still there for all of those who use it to find new music. And thanks to a suggestion on my last post, I’ve enabled users to log in with their SoundCloud accounts and like songs.

对于所有使用它来查找新音乐的人来说,Random 20仍然存在。 多亏了我在一篇文章中的建议,我使用户能够使用他们的SoundCloud帐户和喜欢的歌曲登录。

Learning Node and Javascript properly is going to be a long journey, but I have patience. Three months ago I didn’t even know what a variable was.

正确学习Node和Javascript将会很漫长,但是我有耐心。 三个月前,我什至不知道变量是什么。

You can follow my adventure on Twitter as well.

您也可以在Twitter上关注我的冒险经历。

翻译自: https://www.freecodecamp.org/news/adventures-in-nodejs-d3d1f85a9d3e/

nodejs

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值