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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/396345.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

pytdx 获取板块指数_能否增加一个通过股票代码,板块指数代码获得中文名称的接口?...

T0002/hq_cache/shex.tnfT0002/hq_cache/szex.tnf这个解码就是。/***************************************************股票代码列表和股票名称T0002/hq_cache/shex.tnfT0002/hq_cache/szex.tnf***************************************************/struct TdxSymbolMap {cha…

灵动标签调用友情链接

1、文字形式[e:loop{select * from [!db.pre!]enewslink where checked1 and classid1 order by myorder,20,24,0}] <li><a href"<?$bqr[lurl]?>" title"<?$bqr[lname]?>" target"_blank"><?$bqr[lname]?>&…

4-----Scrapy框架中选择器的用法

Scrapy提取数据有自己的一套机制&#xff0c;被称作选择器&#xff08;selectors&#xff09;,通过特定的Xpath或者CSS表达式来选择HTML文件的某个部分Xpath是专门在XML文件中选择节点的语言&#xff0c;也可以用在HTML上。CSS是一门将HTML文档样式化语言&#xff0c;选择器由它…

【原】Jenkins持续集成环境搭建之创建java项目的job【centos6.5 java maven git 项目】...

一、构建一个maven项目在jenkins主页上&#xff0c;左侧&#xff0c;选择“新建”&#xff0c;然后填写项目名称&#xff0c;选择“构建一个maven项目”二、Git配置保存之后&#xff0c;进入详细配置页面&#xff1a;这里的源码管理&#xff1a;选择git&#xff0c;输入代码的g…

linux修改java内存大小_Linux 和 windows修改java虚拟机内存大小

1、Java内存区域划分&#xff1a; 运行时的数据区:方法区和堆(各个线程共享的内存区域)&#xff0c;程序计数器、Java虚拟机栈和本地方法栈(线程私有的) 程序计数器&#xff1a;当前线程所执行字节码的行号指示器&#xff0c;字节码解释器就是通过改变计算器的值来选取下一条需…

html制作彩虹_制作彩虹

html制作彩虹by Gil Fewster吉尔弗斯特(Gil Fewster) 制作彩虹 (Making rainbows) This is a story about curiosity. It’s also about what happens when you stick a needle into your eye. If you happen to be eating a handful of grapes right this moment, maybe come…

python3 set_python3.x 基础三:set集合

| clear(...) 清空一个集合| Remove all elements from this set.>>>set1.clear()>>>set1set()| copy(...) 影子复制&#xff0c;指向同一个内存地址| Return a shallow copy of a set. |>>> list1[3, 2, 1, 1, 2, 3, 4, 5]>>>…

Linux内核分析作业第八周

进程的切换和系统的一般执行过程 一、进程调度的时机 中断处理过程&#xff08;包括时钟中断、I/O中断、系统调用和异常&#xff09;中&#xff0c;直接调用schedule()&#xff0c;或者返回用户态时根据need_resched标记调用schedule()&#xff1b; 内核线程可以直接调用sched…

iOS--数据存储NSUserDefaults

2019独角兽企业重金招聘Python工程师标准>>> 今天去面试&#xff0c;被问道NSUserDefaults的存取并手写出来&#xff0c;一时想不起来&#xff0c;回来之后看看之前的笔记&#xff0c;稍作一些整理 NSUserDefaults是一个单例&#xff0c;在整个程序中只有一个实例对…

巨人肩膀_如何站在巨人的肩膀上

巨人肩膀“If I have seen further than others, it is by standing on the shoulders of giants.” — Isaac Newton“如果我能比其他人看到更多&#xff0c;那就是站在巨人的肩膀上。” —艾萨克牛顿 In 1676, Isaac Newton spoke of the great thinkers who came before him…

mysql 触发器定义变量_MySQL 函数存储过程触发器定义简单示例

1.变量提示NEW 是新值-- OLD 是旧值INSERT 只有NEW ----UPDATE有NEW和OLD ---DELETE只有OLD2.准备测试表(userinfo、userinfolog)use test;create table userinfo(userid int,username varchar(10),userbirthday date);create table userinfolog(logtime datetime,loginfo varc…

[EOJ439] 强制在线

Description 见EOJ439 Solution 先考虑不强制在线怎么做。 按询问区间右端点排序&#xff0c;从左往右扫&#xff0c;维护所有后缀的答案。 如果扫到 \(a[i]\)&#xff0c;那么让统计个数的 \(cnt[a[i]]\). 如果\(cnt[a[i]]<a[i]\)&#xff0c;那么在当前的右端点固定的情况…

大数据 就业 缺口_中国AI&大数据就业趋势报告:平均月薪超2万,缺口650万人...

2019世界人工智能大会开幕式上&#xff0c;特斯拉公司联合创始人兼首席执行官Elon Musk 和中国企业家俱乐部主席、联合国数字合作高级别小组联合主席马云进行了一场“双马”对话。谈到人工智能话题时&#xff0c;马斯克认为&#xff0c;“未来的科技发展变化将超越我们的能力”…

Android pm 命令详解

一、pm命令介绍与包名信息查询 1.pm命令介绍 pm工具为包管理&#xff08;package manager&#xff09;的简称 可以使用pm工具来执行应用的安装和查询应用宝的信息、系统权限、控制应用 pm工具是Android开发与测试过程中必不可少的工具&#xff0c;shell命令格式如下&#xff1a…

开源 非开源_开源为善

开源 非开源by Michael D. Johnson迈克尔约翰逊(Michael D.Johnson) 开源为善 (Open Source for Good) We’ve spent two years coding for a cause, one nonprofit at a time. And now Free Code Camp’s pushing ahead to help organizations at scale.我们花了两年的时间为…

mysql5.6热升级_Mysql5.6主从热备配置

数据库是应用系统的核心&#xff0c;为了保证数据库的安全采用主从热备是很常见的方法&#xff0c;也就是主数据库DDL、DML都将被同步到从数据库。一、 实验环境操作系统&#xff1a;windowsserver 2008 R2数据库&#xff1a;mysql-advanced-5.6.21-winx64二、 准备工作1、…

InfluxDB(官方使用说明)

安装InfluxDB OSS 此页面提供有关安装&#xff0c;启动和配置InfluxDB的说明。 InfluxDB OSS安装要求 root为了成功完成&#xff0c;需要安装InfluxDB软件包或具有管理员权限。 InfluxDB OSS网络端口 InfluxDB默认使用以下网络端口&#xff1a; TCP端口8086用于通过InfluxDB的H…

incc与oracle连接_Oracle 连接和会话的区别

连接并不是会话的同义词&#xff0c;发现这一点时很多人都很诧异。在大多数人眼里&#xff0c;它们都是一样的&#xff0c;但事实上并不一定如此。在一条连接上可以建立0个、一个或多个会话。各个会话是单独而且独立的&#xff0c;即使它们共享同一条数据库物理连接也是如此。一…

CodeForces 176B Word Cut(DP)

题意&#xff1a;给你a串和b串&#xff0c;你能切k次&#xff0c;每次切完将尾部分放在头的前面&#xff0c;问有多少种方案切k次从a串变为b串 思路&#xff1a;令dp[i][0]为砍了i次变成b串的方案数&#xff0c;dp[i][1]为砍了i次变成非b串的方案数&#xff0c;然后预处理一下前…

如何将React App转换为React Native

I have been working on a lot of mobile projects lately — including Cordova, PhoneGap, React Native, some Ionic and Swift — but I have to say, React Native is by far the best experience in mobile development I have had so far. It has great, web-like d…