VehiclesFashionRecipesBlogsHuntTravelsSportFunHandmadeITEducation
Mini-Games
x

x
zakruti.com » IT - Software » freeCodeCamp.org
Deno Course - Better than Node.js?

Deno Course - Better than Node.js?

FBTwitterReddit

video description

Rating: 4.0; Vote: 1
Learn how to use Deno in this complete course. Deno is a Node.js alternative created by the same person who created Node.js. In this tutorial course, you will learn how to build real apps with Deno. You will also learn the basics of the Typescript. You will see how to use Deno to build a survey app with a REST API using MongoDB. - Code: https://github.com/thecodeholic/freecodecamp-deno-course - Survey application code: https://github.com/thecodeholic/deno-survey - Course from The Codeholic. https://www.youtube.com/channel/UC_UMEcP_kF0z4E6KbxCpV1w - The Codeholic on
Date: 2022-03-14

Comments and reviews: 10


Some of you might have issues while getting the requested content from the request header.
As per the oak documentation, the code has changed a bit
See below code to get your code up and running
register = async (ctx: RouterContext) => -
--try -
---const result = ctx.request.body(-
----contentTypes: -
-----text: [-application/json-], // Specifying the request body to be application/json only
-----,
----);
---const requestContent = await result.value; // Getting the request body
---console.log(requestContent);
--- catch (error) -
---console.log(-[ERROR]-, error);
---
--;

reply

this code help in the lasted version oak 6.3.0 :
async register (ctx: RouterContext)--
const result = ctx.request.body();-
if (result.type ===-json-)--
const - name, email, password - = await result.value;-
const user = await User.findOne(- email -);-
if (user)--
ctx.response.status = 422;-
ctx.response.body = - message: - Email is already used--;-
return;-
--
console.log(name, email,password );-
-

reply

Thank you for taking the time to create that long tutorial.. we're all grateful for it...
However, I think many things changed with deno and oak. Because when I tried to follow your tutorial, I couldn't use the user.save() in the AuthController file to register a user.
Any idea how to call that function from the User class?
Thanks in advance...

reply

After trying out TypeScript a bit, I must say, it seems a pretty minimal add-on to JavaScript So if you already know JavaScript, this certainly seemed like a breeze to me. Of course, this is just from a small test run. I think it's worth going deeper with it, because of the extra control and fault-resistance it's supposed to give you.
reply

I just finished the course. Excellent! Thank you!
I liked the bug chasing next to the end of the video. It gives us a look of how real programming work is. When I found myself in similar situations, often I feel like programming is not for me.
Also, as a hobbyist JS programmer, Deno feels so more natural than node. I like it!

reply

I really don't understand the most touted feature of deno i.e., security (sand box model). My question is who is stopping any user from running any deno application with --allow-all flag. For example, if I am a malicious user I can run deno with --allow-all flag, who is stopping me from doing it. Can anyone please explain.
reply

aaand it's broken with the latest versions:
TS2322 [ERROR]: Type 'User' is not assignable to type 'UserSchema & WithID'.
Type 'User' is missing the following properties from type 'UserSchema': _id, username
user = new User(- name, email, password: hashedPassword, -)
-

reply

If you have issues connecting with mongo atlas add this to the end of the client.connect (as is the method used in the last mongo driver version not Uri) -&authMechanism=SCRAM-SHA-1- without quotation of course so the connection recognize the new authentication mechanism.
reply

For those of you having problems with register() function, the following works:
async register(ctx: RouterContext) --
const - value - = ctx.request.body();-
const -name, email, password - = await value;-
console.log(name, email, password);-
-

reply

Honestly, if a person doesn-t have a lot of experience with NodeJs won-t see much of a difference. Like example is authentication. Unless you-ve mastered it on NodeJs. You won-t understand the implications on deno
reply
Add a review, comment






Other channel videos