Vanilla Node.js REST API | No Framework

Vanilla Node.js REST API | No Framework

Traversy Media

55 лет назад

168,618 Просмотров

Let's create a REST API using Node.js only, without Express

Code:
https://github.com/bradtraversy/vanilla-node-rest-api

💖 Support The Channel!
http://www.patreon.com/traversymedia

Website & Brad Traversy Udemy Course Links:
https://www.traversymedia.com

Follow Traversy Media:
https://www.twitter.com/traversymedia
https://www.instagram.com/traversymedia
https://www.facebook.com/traversymedia

Timestamps:
0:00 - Intro
2:03 - Getting Started
3:06 - HTTP Create Server
5:27 - Send a Simple Response
10:43 - Simple Routing
13:17 - Create The Model & Controller
14:45 - Get All Products
19:35 - Get Product By ID
27:15 - Create Product
39:17 - Getting Body Data
48:38 - Updating Products
56:36 - Deleting Products

Тэги:

#node #node.js #node.js_rest_api #rest_api #node_rest_api_no_framework #restful_api
Ссылки и html тэги не поддерживаются


Комментарии:

@TraversyMedia
@TraversyMedia - 15.10.2020 16:21

I realized I have never done this. In an actual project, you would most likely use Express or some other framework, but I wanted to do this for learning purposes so you can see a bit of what goes on under the hood. This API can be improved (eg. creating a better router), so feel free to work on it and make a PR :) Hope you enjoy!

Ответить
@Parvizjoon89
@Parvizjoon89 - 13.02.2025 00:36

Wow bro the way you explain things is truly next level!!! All your tutorials and the way you take us step by step with every project that you build is honestly just a MASTERCLASS! Can't thank you enough for everything bro!

Ответить
@sanjaux
@sanjaux - 10.09.2024 21:29

THIS is what I was looking for, it's like learning JS before you learn React. Every other video has been "just use this service" without even explaining the abstraction of the original things those call to.

Ответить
@devwithbrian1534
@devwithbrian1534 - 01.09.2024 16:04

Thanks Brad

Ответить
@EdyLopez-o1d
@EdyLopez-o1d - 01.09.2024 05:08

Thank you man, very helpfull this video. Really appriciate it I will follow your channel jejej again Thanks a lot

Ответить
@ValiantViper123
@ValiantViper123 - 07.07.2024 20:26

best video, i love it

Ответить
@ikhsan2652
@ikhsan2652 - 13.06.2024 15:45

amazing!! Thankyouu

Ответить
@ngreader9224
@ngreader9224 - 18.04.2024 22:35

thankyou so much for sharing

Ответить
@devwithbrian1534
@devwithbrian1534 - 27.03.2024 23:10

Thanks Brad

Ответить
@itsnobledean9450
@itsnobledean9450 - 20.11.2023 21:45

it don’t matter if you have an issue or not, if you plan on learning like this, don’t expect to be helped. these people put all this information in a video, don’t ever come back to read comments or anything. this shit sucks. if you are new to this shit, you’re going to see a lot of the same bullshit.

Ответить
@itsnobledean9450
@itsnobledean9450 - 20.11.2023 20:47

my shit was working before all of the new folders, and i followed everything he did. this is the number 1 reason this type of learning is complete ass. dude just doing this for views. you won’t get any reply.

Ответить
@FabioGiacomini
@FabioGiacomini - 11.11.2023 21:32

Awesome video, very well explained. Thank you

Ответить
@olezunka
@olezunka - 24.10.2023 22:19

Thank you for your video.

Ответить
@OwaisAhmed-j8n
@OwaisAhmed-j8n - 07.09.2023 14:56

thank u sooooo much really worth and i made it with u step by step , it's fully functional at me

Ответить
@princeoguru446
@princeoguru446 - 31.08.2023 17:14

This was a great project sir I enjoyed the video please can we get this video sithe a real life project just to see how this applies in a real life situation
I still dont understand where and how to apply this in a real life project
I would love you do a video like that and a big thks so far

Ответить
@akramnarejo6221
@akramnarejo6221 - 22.05.2023 11:32

thanks for creating a beautiful content. and I happy to let you know that I completed it.

Ответить
@LuyandaDuma-s7s
@LuyandaDuma-s7s - 14.05.2023 17:20

Please make a video of how you'd do this using a sql server database

Ответить
@MrRetroVinyls
@MrRetroVinyls - 08.05.2023 22:01

I wonder how your api manages to work with uuid generated id that is checked by regex (in server.js) that seeks for numbers
/\/api\/products\/[0-9]+/ i had to rewrite mine like this /\/api\/products\/(\d+|[a-f0-9-]+)/ in order to get it to work

Ответить
@_rtdp_
@_rtdp_ - 29.03.2023 10:49

Change match expression to req.url.match(/\/api\/products\/([\d]|-?[\d[a-f])+/) everything else will just work fine...

Ответить
@salimsulaiman1909
@salimsulaiman1909 - 16.03.2023 05:08

Can I use such API to fetch data into a mobile app?
Thanks, Brad ✌️

Ответить
@datkumar1024
@datkumar1024 - 28.01.2023 16:39

I think the RegEx for "/api/products/:id" urls considering uuids would be
/\/api\/products\/([a-zA-Z0-9\-]+)/

Ответить
@chinmayghule8272
@chinmayghule8272 - 23.01.2023 20:46

I followed through the entire course except for one thing. I used a regular array instead of a json file since I was using an old file from a previous tutorial. Because of this every time the server restarts all the changes made in the server got overridden and I had to start over again. Nice course, this really makes me appreciate Express.js.

Ответить
@Mescudi94
@Mescudi94 - 10.01.2023 13:44

One of the best tutorial I have seen, thank you for this. Plus, you have a way to speak which is very comprehensible for non-english people like me, I'm quite amazed to understand very well each word !

Ответить
@pileydes
@pileydes - 07.01.2023 11:32

Thank you very much, really much appreciated.

Ответить
@asdfkj123
@asdfkj123 - 31.12.2022 22:20

can you please explain why we did chunk.toString() in the getPostData function ?

Ответить
@asdfkj123
@asdfkj123 - 31.12.2022 22:03

When using " writeDataToFile("./data/products.json", products) " in productModel, why do we only put 1 dot before /data, and not 2 dots ? don't we need 2 dots to go outside the models folder?

Ответить
@alvaroaliaga7892
@alvaroaliaga7892 - 03.11.2022 04:00

great

Ответить
@ЯковВладимиров
@ЯковВладимиров - 30.10.2022 08:02

Incredible quality video! Good voice record and nice material!
Thank you very much!

Ответить
@sarveshsakpal8241
@sarveshsakpal8241 - 14.10.2022 12:48

thx bro

Ответить
@raiyanthedeveloper
@raiyanthedeveloper - 12.09.2022 15:52

Thank u so much for making this video.

Ответить
@topsecret8871
@topsecret8871 - 03.09.2022 21:43

thank you!!

Ответить
@mashilheiba1nm720
@mashilheiba1nm720 - 17.08.2022 11:51

Thanks

Ответить
@devope
@devope - 04.08.2022 09:31

I want to thank you so much!

Ответить
@David-mp2jt
@David-mp2jt - 01.08.2022 20:08

G-O-L-D

Ответить
@koki10190
@koki10190 - 21.05.2022 00:12

ok wow thats easier than i really thought

Ответить
@wonjoongcheon5352
@wonjoongcheon5352 - 24.04.2022 09:25

Greatly AWESOME!!

Ответить
@laikesagores3258
@laikesagores3258 - 17.04.2022 20:51

Great video, very helpfull, understanding. Thank you!!!

Ответить
@laikesagores3258
@laikesagores3258 - 16.04.2022 19:32

Amazing video!!! Thank's a lot...

Ответить
@piyushaggarwal5207
@piyushaggarwal5207 - 28.03.2022 15:24

CRUD me

Ответить
@piyushaggarwal5207
@piyushaggarwal5207 - 28.03.2022 15:24

thank you for the video

Ответить
@biswayannandi6136
@biswayannandi6136 - 05.02.2022 15:49

There are many videos and blogs with titles 'REST API using NODE' and each one them are using Express. I wanted to learn how can I do it using Node only and I got this...Great work💕❤

Ответить
@debobratapal7162
@debobratapal7162 - 19.01.2022 22:13

Getting a lot of bugs even though I used the same code...please help

Ответить
@cookiesndata211
@cookiesndata211 - 28.12.2021 06:48

I enjoyed it ,thanks . Keep up great work. Have a Happy New year .

Ответить
@Pareshbpatel
@Pareshbpatel - 15.12.2021 05:01

Completed excellent tutorial on CRUD API in Vanilla JS. Thanks, again, Brad
{2021-12-16}

Ответить
@stuartmarsh5574
@stuartmarsh5574 - 13.12.2021 05:18

Thank you, great video. It took me forever to realize that my delete response body wasn't showing up because I used a 204 response code. I like the idea of using a 200 and being able to confirm the deletion.

Ответить
@PuzzlerCraft
@PuzzlerCraft - 11.12.2021 10:24

How can I connect Angular with Node (of couse as API ) without Express ?

Ответить