
Deno Course - Better than Node.js?
video description
Date: 2022-03-14
Related videos
Comments and reviews: 10
Ankur
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
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
Junior
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
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
Hazem
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
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
kebman
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
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
Pablo
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 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
Ramender
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
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
Treehead667
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
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
Kendort
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
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
Rade
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
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
SSKDev
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
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















