No video

NodeJS Swagger API Documentation Tutorial Using Swagger JSDoc

  Рет қаралды 141,031

Maksim Ivanov

Maksim Ivanov

Күн бұрын

📘New Course: Build full-stack React Typescript applications tsreact.maksim...
In this video we'll build an ExpressJS CRUD application and document it using Swagger. We'll
use swagger-jsdoc to write the specs and express-swagger-ui to show the Swagger interface.
🐦 Twitter: / ivanov_dev
I write about React and TypeScript there
Code: github.com/sat...
Codesandbox: codesandbox.io...
Video About Testing React Query Components: • How To Test React Quer...
My discord: / discord
Follow me on Odysee: odysee.com/$/i...

Пікірлер: 153
@codekomali1760
@codekomali1760 2 жыл бұрын
Nice tutorial! For those who have a working restful service(s) and want to learn only the swagger part, you may safely skip to 9:50
@shadowbytee
@shadowbytee 2 жыл бұрын
Thanks alot!
@JackSomethingTheShow
@JackSomethingTheShow 2 жыл бұрын
For anyone struggling with lowdb, change the declaration to import cors from 'cors'; import express from 'express'; import morgan from 'morgan'; import { Low, JSONFile } from 'lowdb'; import { dirname } from 'path'; import { fileURLToPath } from 'url'; import { join } from 'path'; const __dirname = dirname(fileURLToPath(import.meta.url)); const file = join(__dirname, 'db.json'); const adapter = new JSONFile(file); const db = new Low(adapter); const PORT = process.env.PORT || 4000; db.defaults({ books: [] }).write(); Remeber to add type: module to your package.json file
@raymondabid3258
@raymondabid3258 2 жыл бұрын
the best tutorial on the internet. did it all under 30 minutes. others tried and took them 10 videos to explain what you did in that time. well done and thanks for the help!
@prasadphule
@prasadphule 3 жыл бұрын
I'd love to see some Typescript in future for your code example.
@ilyacherkasov9251
@ilyacherkasov9251 3 жыл бұрын
Oh yes, good idea! I'd like to see examples in TypeScript
@mitchelleuzonna4523
@mitchelleuzonna4523 Жыл бұрын
Amazing tutorial. Using typescript would be a welcome development.
@rafa_veiga
@rafa_veiga 2 жыл бұрын
Hi Maksim! Thanks for sharing your knowledge, it helped me a lot with my new job. A big hug from Brazil.
@syammohan3039
@syammohan3039 3 жыл бұрын
Found this very much useful for me as I am a beginner to Swagger :-)
@adrianzinko6292
@adrianzinko6292 2 жыл бұрын
This tutorial was very helpful for me, thank you. I'd like to see more of your tutorials in TS.
@damonwu9658
@damonwu9658 3 жыл бұрын
Thanks Maksim, good stuff, and yup, I'd love to see some typescript knowledge share ~~
@esmaeilmirzaee
@esmaeilmirzaee 3 жыл бұрын
Using TypeScript as the programming language would be so nice.
@saboya700
@saboya700 2 жыл бұрын
Hey Maksim, thank you so much for this content. Found in a very good timing because my team will start to use swagger and its routes/documentation soon. I had the opportunity to put in practice and also meet that great channel of yours. I started following and subscribed the newsletter. Hope to learn more with your explanations (specially in TS) here. Best regards
@Tom-vr5yv
@Tom-vr5yv 2 жыл бұрын
name: maksim
@avoidloves
@avoidloves 3 жыл бұрын
Thanks for the tutorial!! Make a typescript playlist man.
@andriisen1892
@andriisen1892 2 жыл бұрын
Максим! Спасибо огромное за суперское видео, поделюсь с братьями по стажировке)
@raymondmichael4987
@raymondmichael4987 Жыл бұрын
Been searching for this, I’ll try to play with it when I got a chance, thanks 😊
@Beats4needs
@Beats4needs 3 жыл бұрын
If you want to follow this tutorial then make sure you install swagger-jsdoc like this: npm i swagger-jsdoc@6.0.1 Otherwise, it won't work with the current version 7 of swagger-jsdoc which breaks everything and is a pain in the ass to setup.
@satansdeer1
@satansdeer1 3 жыл бұрын
Thanks for this update
@darcy4487
@darcy4487 3 жыл бұрын
You deserve a dollar
@TheIGORYA76
@TheIGORYA76 3 жыл бұрын
Had similar issue with lowdb had to go back and use npm i lowdb@1.0.0
@fromkotahujan
@fromkotahujan 3 жыл бұрын
@@TheIGORYA76 great thanks 👍
@anvarichn
@anvarichn Жыл бұрын
Yes, TS would be great! Or, at least using ESM modules in JS - that would be great as well! Let’s forget those old require() stuff and use imports!
@feijobruno
@feijobruno 3 жыл бұрын
This video helped me a lot. Thanks for the tutorial!!!
@linclicin3326
@linclicin3326 3 жыл бұрын
Thank you very much for such an awesome tutorial. Yes, Please use Typescript
@lewissheridan
@lewissheridan 11 ай бұрын
Nice job. Be great to add in the authentication bit. I managed to refer to the docs for that.
@yossiarye6886
@yossiarye6886 Жыл бұрын
Thank you, typescript will be great
@luzaw4957
@luzaw4957 3 жыл бұрын
For those who comes here to learn swagger, it starts at 9:52
@carloemil
@carloemil 2 жыл бұрын
Yes, TypeScript would be better. Thanks for the video!
@hieu_nguyen_20
@hieu_nguyen_20 2 жыл бұрын
Easy to follow coding and awesome. Keep it up !
@wimveldhuis1828
@wimveldhuis1828 3 жыл бұрын
Great tutorial, thanks Maksim!
@bbz9002
@bbz9002 3 жыл бұрын
If you have - "Error [ERR_REQUIRE_ESM]..." In package.json Downgrade: "swagger-jsdoc": "6.0.0" "lowdb": "1.0.0" Upgrade dependencies, execute in console (project directory) $ rm -rf node_modules/ $ npm install
@adventurer2395
@adventurer2395 2 жыл бұрын
Awesome tutorial! Really like your examples. Any chance you could do another swagger tutorial with with typescript and mongoose/mongo?
@alint
@alint 3 жыл бұрын
Thank you for the very informative video, loved the pace of the the scripting and the explanations! subscribed!
@KonstantinMiami
@KonstantinMiami 3 жыл бұрын
Hi every one, great job! Only one thing, when I was use method POST, it was created new book but not added in db.json so I was changed // res.send(book) --> res.send(req.app.db.get("books") and now all working well for me.
@artless-soul
@artless-soul 3 жыл бұрын
Thank you for nice tutorial! typescript examples in future +1
@HovhannesGasparyan-ex4el
@HovhannesGasparyan-ex4el 4 ай бұрын
Thank you for the useful video)
@techguy6049
@techguy6049 3 жыл бұрын
And i thought it will be about swagger. And it was. Lol. Robotic tutorial!
@ryannichols1798
@ryannichols1798 Жыл бұрын
may be a bit late but I'd like the typescript content much more
@roba998877
@roba998877 2 жыл бұрын
+1 to Typescript
@2cents2go
@2cents2go 2 жыл бұрын
cool example! I guess no one has done a video on how to customize swagger-ui-react documentation is scarce
@mehdigozar9627
@mehdigozar9627 2 жыл бұрын
Thank you. It was very good
@berakoc8556
@berakoc8556 3 жыл бұрын
This video helped me a lot. Thanks.
@RealEstate3D
@RealEstate3D Жыл бұрын
Of course TypeScript is the way to go.
@JawadAli-xi5wh
@JawadAli-xi5wh 3 жыл бұрын
Great tutorial. But a good readable theme (particularly for swagger comments) of the code editor would help to read the code.
@satansdeer1
@satansdeer1 3 жыл бұрын
do you know of any?
@runyalen
@runyalen Жыл бұрын
yhea good idea... everything was gray... it wasn't super neet to see code
@raidalmoued664
@raidalmoued664 2 жыл бұрын
Very Good tutorial. Many thanks
@Dgiulian
@Dgiulian 3 жыл бұрын
Great video. I would like to see more TS videos.
@sergeykahnwald6640
@sergeykahnwald6640 Жыл бұрын
Nice doing man!
@CodePremier2000
@CodePremier2000 Жыл бұрын
Thank you so much❤❤ Very helpful
@eliasnacherfernandez9237
@eliasnacherfernandez9237 2 жыл бұрын
So clear code, nice work
@galiprandi
@galiprandi 3 жыл бұрын
I love typescript too!
@runyalen
@runyalen Жыл бұрын
what happend if I have several files with swagger code(Like at least 18 different files).. Where should i add them into my rooter ??
@kiddosknowledgewizbyakshit9954
@kiddosknowledgewizbyakshit9954 Жыл бұрын
Very helpful video....Thanks a lot Kindly make some video for authorization with the same
@j.k.ravshanovich
@j.k.ravshanovich 2 жыл бұрын
I am getting an error: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: Any suggestions?
@brendanduffy827
@brendanduffy827 2 жыл бұрын
great video thank you. maybe a mix of JS and TypeScript...for variety.
@tusharcitrusbug4912
@tusharcitrusbug4912 Жыл бұрын
a perfect video for me
@igormundim
@igormundim Жыл бұрын
Thank you very much! 🇧🇷
@pguti778
@pguti778 3 жыл бұрын
I'm using your example for a jobposting ! let's see what they say ! ;)
@sede189
@sede189 Жыл бұрын
Excellent tutorial
@segunthemarketer2195
@segunthemarketer2195 2 жыл бұрын
JavaScript please! Great video… Love it
@swagatsahu5197
@swagatsahu5197 Ай бұрын
guys, I will make a video on Swagger which is easier than this tutorial. all these KZfaqr follows the same method to write the swagger documentation but I have the easiest way where a noob can understand the swagger implementation.
@samyh40
@samyh40 3 жыл бұрын
Pure gold! Thank you
@thegrind9628
@thegrind9628 Жыл бұрын
Even if I press Execute button @16:37, I'm not shown the response. Whereas I am able to see the correct response from RESPONSE TAB from the browser dev tools. Why is that
@user-li8zb6ur2z
@user-li8zb6ur2z 4 ай бұрын
Почему-то легче воспринимать английский язык от славян, чем он носителей : )
@rutvikmehta4657
@rutvikmehta4657 3 жыл бұрын
i think your update documentation does not affect the database, i tried that. same query with postman fire perfectly worked!
@zvrk
@zvrk 3 жыл бұрын
Typescript is the future, and everyone should try to learn it, so i would stick with ts.
@xanyula2738
@xanyula2738 3 жыл бұрын
Suppose I keep the schemas from mongoose in a separate file from routes, how do I instruct swagger-jsdoc to parse schema instructions from there ? just add the path to apis section in the options object ? Or is there anything wrong with doing that
@huseyinbilen3535
@huseyinbilen3535 2 ай бұрын
Nice tutorial thanx. What's your VS Code theme? It's look so good an understandable.
@deepgandhi1106
@deepgandhi1106 2 жыл бұрын
1) Suppose, I have a schema for Project model which contains 20 properties. Now for my project-dropdown API I only need 3 properties from the schema then how I can refer the schema and pick few properties only? 2) I have 2 schemas, one for Project with 20 properties and another one is Task with 10 properties. Now for ProjectDetails API I have response something like { id: 1, name: "ProjectName", tasks: [ {id: 1, name: "TaskName"} ] } Now how I can accomplish this nested object by referring both individual schema which are Project and Task 3) Can I have search box in Swagger UI to filter APIs?
@teyiadzufehh
@teyiadzufehh 11 ай бұрын
9:48 for anyone here purely for the Swagger tutorial
@vladmacovei1619
@vladmacovei1619 3 жыл бұрын
I believe that adding components schemas to the definitions object inside options is a little bit neater. This way you avoid having orphan jsdoc comments in route files (i actually don't know if swagger-jsdoc is able to merge multiple components schemas into one). Also if you add it to the definitions object the syntax is js not yaml nonsense, much easier to write in vscode.
@bushranikhat2326
@bushranikhat2326 3 жыл бұрын
Thanks for this tutorial
@oluwatoyinbalogun1684
@oluwatoyinbalogun1684 3 жыл бұрын
Thanks alot for the video. I would prefer Typescript
@martindm6019
@martindm6019 2 жыл бұрын
How remove a book in lowdb version 3.0?. The method remove, not exists.
@Stevexupen
@Stevexupen Жыл бұрын
how do you get the auto indenting inside the multi-line comment to work in vscode?
@objectObject212
@objectObject212 3 жыл бұрын
Hi, thanks for great video, definitely I am gonna be using swagger! I have just one question, why only post / route has try catch block and 500 response? Is there any reason for that or it is just by example?
@Eibon1599
@Eibon1599 2 жыл бұрын
Hi your tutorial is amazing, i have a problem, the swagger when a running in my local show the swagger page and the APIS, but when a try run the swagger in my server AWS this show nothing. what will be the problem so that it does not show anything in the server
@octaviusbytes
@octaviusbytes 2 жыл бұрын
This may require more video editing but, I would be nice if you make video's using typescript as it's trending towards the standard. Then add javascript comment alt post edit, just for future proofing.
@abhik9077
@abhik9077 8 ай бұрын
Hey how to use bearer token ? in swagger
@Najumulsaqib
@Najumulsaqib Жыл бұрын
Swagger thing begins from 9:57
@funtym6083
@funtym6083 Жыл бұрын
Please prefer typescript over JS... as this resonates with my liking too
@Huan2259
@Huan2259 2 жыл бұрын
yes, Typescript will be more preferred since most of the actual coding is done in typescript by the developers.
@Huan2259
@Huan2259 2 жыл бұрын
Thank you for the nice Tutorial
@ugwukelechi4138
@ugwukelechi4138 Жыл бұрын
As you asked, javascript is fine by me
@tobaojo2292
@tobaojo2292 Жыл бұрын
Nice tutorial. Can we have one which includes the authorization header?
@adamtak3128
@adamtak3128 3 жыл бұрын
at 7:14 you say you cut a corner and that you're only doing this because it's an example project. What would you be doing in a real-world app instead?
@juanjoseordonez8669
@juanjoseordonez8669 2 жыл бұрын
You need to define a specific model, because in the way he did it any format is valid, that isnt correct in a real project
@rafatanzeem4040
@rafatanzeem4040 Жыл бұрын
nice video, I am looking for authentication Video using swagger
@mrugeshprajapati6406
@mrugeshprajapati6406 Жыл бұрын
Hi Maksim, thanks for Tutorial. It worked perfectly on localhost, but after deploying it shows "No operations defined in spec!" and no requests are shown. Please help me out with this issue.
@hrithikvishwakarma001
@hrithikvishwakarma001 Жыл бұрын
what is your theme name ?
@Huntergaming-ci7un
@Huntergaming-ci7un 3 жыл бұрын
Hi, Thanks for video. I love your VS color scheme, can you please provide it so I can use it for myself?
@abedaarabi3014
@abedaarabi3014 3 жыл бұрын
great job !
@BheemuR
@BheemuR 2 жыл бұрын
Nice programming skill. I am new to nodejs and looking for swagger api documentation, please share this code with me so that I will explore more on this.
@helloworld9655
@helloworld9655 2 жыл бұрын
Check descriptions
@BheemuR
@BheemuR 2 жыл бұрын
@@helloworld9655 please create video on node with typescript swagger.
@tonygeorge7482
@tonygeorge7482 3 жыл бұрын
hi when i call post request only id is created title and author is not adding what is the issue i use ...req.body
@nguyenvanai6872
@nguyenvanai6872 2 жыл бұрын
how injection style sheet for swagger? thanks you
@smolahloe
@smolahloe 3 жыл бұрын
More codes with TypeScript please
@AhmedIbrahim-wx8sm
@AhmedIbrahim-wx8sm 2 жыл бұрын
how can i add bearer token in header to the request
@manthanguptaa
@manthanguptaa 3 жыл бұрын
What if my application is exposed to localhost:8081 and I want to serve my swagger docs on localhost:8080?
@farenrai576
@farenrai576 3 жыл бұрын
is it possible swagger notation define in separate file ? not in route section if more then 1000 or 2000 routes
@personal1935
@personal1935 3 жыл бұрын
Many thanks for this video tutorial, I personally use your tutorial a lot and help me to understand them more easily, I have a question, for backend with node I can see you use expressjs, would you recommend this for production or do you know or can point me for a better choice? do you know any page which compares different tools/libs for node backend technology?
@satansdeer1
@satansdeer1 3 жыл бұрын
hi, well two major backend libs for node are expressjs and nestjs. The problem with express is that it is a like a constructor kit, it is very minimalistic. You have to make lots of decisions when working with it and likely use a bunch of other libraries. Nest is more like a combine. It has a lot of decisions made for you and you got to learn the way the creators of the lib intended it to be used. Hope this helps
@personal1935
@personal1935 3 жыл бұрын
@@satansdeer1 Many thanks, I will check the NestJS
@HinhTranVan
@HinhTranVan Жыл бұрын
wow theme beautiful . Can you tell me the name of this extension?
@mddanish8704
@mddanish8704 2 жыл бұрын
please make the same video in typescript 🙏
@hypersudo8092
@hypersudo8092 3 жыл бұрын
Getting swagger jsdoc import error please help to fix.
@LaSombraDeMuerte
@LaSombraDeMuerte 3 жыл бұрын
Telll me please what color them for editor you use, thanks
@nguyenvanai6872
@nguyenvanai6872 2 жыл бұрын
can you tell me? what is theme and fonts you use for Vscode? thank you so much
@rebeccaburch3334
@rebeccaburch3334 3 жыл бұрын
what vscode theme is that? yes, i'm that person. love themes 😅
@1656456
@1656456 2 жыл бұрын
i dont know why but my methods doesnt return anything
@ofjdaz
@ofjdaz 3 жыл бұрын
ruquire lol, the library by RuPaul :)
OpenAPI и Swagger Editor - своё описание REST API с нуля
16:35
IT как Конструктор
Рет қаралды 82 М.
Вы чего бл….🤣🤣🙏🏽🙏🏽🙏🏽
00:18
Lehanga 🤣 #comedy #funny
00:31
Micky Makeover
Рет қаралды 29 МЛН
Kids' Guide to Fire Safety: Essential Lessons #shorts
00:34
Fabiosa Animated
Рет қаралды 14 МЛН
Autogenerating Swagger Documentation with Node & Express
14:59
Beyond Hello World
Рет қаралды 159 М.
REST API and OpenAPI: It’s Not an Either/Or Question
9:17
IBM Technology
Рет қаралды 208 М.
How I Made JavaScript BLAZINGLY FAST
10:10
ThePrimeagen
Рет қаралды 217 М.
Swagger with Node & Express in-depth tutorial
1:09:19
Syed Zano
Рет қаралды 31 М.
How to build a REST API with Node js & Express
58:40
Programming with Mosh
Рет қаралды 1,7 МЛН
Why use Type and not Interface in TypeScript
14:12
ByteGrad
Рет қаралды 201 М.
Кратко про OpenAPI и Swagger
26:43
IT как Конструктор
Рет қаралды 50 М.
The Story of Next.js
12:13
uidotdev
Рет қаралды 564 М.