Build a REST API in TypeScipt - ExpressJS and Prisma
HTML-код
- Опубликовано: 2 июн 2024
- In this video we're going to build a basic REST API using TypeScript, ExpressJS and Prisma.
👨💻 Looking for a web developer job, visit: www.webdevjobs.io/
👽 Discord - / discord
⏳ Timestamps
0:00:00 - Intro
0:02:05 - Installation
0:06:36 - Prisma Schemas and Database Setup
0:28:37 - Server Setup
0:33:19 - Author Services and Router
1:04:41 - Book Services and Router
The finished code can be found here:
👾 - github.com/sixfwa/express-typ...
#typescript #expressjs #prisma
👽 Join the Discord Server (link in the description)
Wow I love the style of your teaching 😍
Wow, thank you!!
great job for juniors! thanks!
Thank you! Im glad that it helped :)
Very well explained. Big project but super easy to follow 😎
Thanks a lot! Glad that you found it useful :)
Great video!
Thank you very much!
If you enjoyed this video - please leave a Like and Subscribe for more :)
Great Video Dude, :) Actually i'm bit of django fanboy, i think we can implement the same thing using drf in much shorter timeframe.
anyways, i might follow along this in future, as of now i prefer working with js in frontend only.
why didnt' you use ts-node ??
Thanks a lot for the video .Very well explained.
Glad it was helpful!
Great video, I've learned a lot from it thank u very much
I just have one question please. So I've just finished coding my REST API and now its ready for production phase; How do I go about building or compiling my project, I've read a lot of articles that say you need to compile out typescript project, but I lose my generated Prisma client in the process. And its not ideal to deploy your project with dev depends like Nodemon just to have working. I'm really stuck at this point can you please explain this to me
I am beginner in terms of backend dev, it helped me understand prisma, the services and route seperations, validators, and integration with a sql database.
I'm going to try such a project with postgresql
Awesome!! Best of luck. You can keep us up to date on our Discord server also with your progress (check description)
Great video
Thank you 🙏
Very nice video, great job!
For some reason, I thought Prisma is only used for GraphQL, but seems like it's got everything covered!
It's an amazing ORM. With TypeScript the experience is x100
Totally agree, watching your video, I see that it seems really nice!
Well done. Please do some tRPC next.
It's on the way. Have one with the T3 Stack
Can't we use the types that prisma generates for our models, instead of typing them on our own?
You can 😂
by the way, which keyboard were you using when recording this video?
The Apple Keyboard :)
Great video, good job! Although I am not clear how to work with nullable fields
Thank you very much! What exactly confuses you?
what is your editor theme?
It's looking 👌
From the Noctis collection :)
which theme u r using ?
From the Noctis collection :)
Nice mate! Next do Laravel if you want.
How are you using Typescript with no tsconfig.json???
same qes bro
I am a beginner and I don't understand how or why you are giving it info through GET instead of POST, pleas help
This is because I just want the information for a given object. I am not writing to the database
Yuval Noah Harari? Really? What books did you read from him?
"How despicable human race is" or "The Deplorables" co-authored with Hillary Clinton? Or "You'll own nothing and will be happy"?
And by the way, correct the prisma schema for authors and books to have many to many relationship.
Why are you so pressed about this? It's a programming tutorial not a book review
Actually I was looking for a prisma tutorial, featuring books and authors, like "Mein Kampf" written by a little moustache guy in 1925. But I should be satisfied with authors like Harari and his mentor Klaus Schwab. Their ideas of sociopathy are very close the little moustache man.
Fuck this shit.
Hey @rithmic I have a problem with this code on the "seed.ts". line 40, error: 'author' is possibly 'null'.
hey you found any solution?
This is only a warn that come from typescript, just ignore it.
If you don't want to ignore the problem, you can add a check and put the await where the error is happening in the check.
if (author) {
await ...... (the code where the problem is)
} else {
console.log("author not found")
};
This error is happening because we can't be sure that we will find an author with the name Yuval Noah, so TS is basically telling you that errors might happen here, so it is better to prevent accessing properties that are potentially null or undefined.