Next.js API Routes using next-connect

preview_player
Показать описание


Timeline:
00:00 Introduction
01:43 Show database structure
02:06 Show /api/champions using POSTMAN working for all methods
02:31 Show /api/drivers using switch/case
03:00 Use next-connect for /api/champions
04:44 Setup onNoMatch in next-connect
06:00 Setup onError in next-connect
07:52 Share next-connect handlers across our api routes
08:42 Move from switch/case to next-connect
10:24 Middleware for authentication and authorization
19:48 Conclusion

----
----
----
----
----

----
Follow me on:
Рекомендации по теме
Комментарии
Автор

Oh man what have you done??? You posted this video 3 years ago and today on 25th September 2023, no other next-connect video is available on youtube and those which are available cannot match your level of explanation. Thanks brother. May Allah bless you more.❤❤

shahbazali
Автор

This is only YouTube channel having very good content of Nextjs, So I really recommend to watch content, if you are a beginner don't worry Bruno explain each and every step one by one. Rightnow nextjs becoming all in one platform, So keep Rocking....
And I waiting for upcoming tutorial..

vigneshamudha
Автор

Hello, Bruno! Thank you for your video, was extremely helpful!


+'1 subscriber
+1 S2

nicoazedo
Автор

Bruno you're videos are just great. During my experimenting with NextJS, I also tried to connect it with custom server (Express). Meaning, having full ability to control end points and use middleware. So, the question is, how next-connect is better? Why use one over the other? Pros and Cons?

oritkozolin
Автор

great video and explanation. my only confusion is what does next() actually do? you said it goes to the next piece of middleware, but i don't understand what the next piece of middleware is in this example. thank you!

SakosTechSpot
Автор

What an AMAZING tutorial! Thank you so much! My code will be so much cleaner now =)

lumenwrites
Автор

Hi Bruno, great content could you a video showing how to upload multiple files to was s3 using multer-s3 and next-connect? It’s been 2 years that you are playing with nextjs you should be an expert now. Thank you

ekton
Автор

I think it's much cleaner to execute middlewares with next-connect than using wrapper functions in next.js as I have seen in your tutorial,

jamesmugambi
Автор

Hi Bruno.. Thanks so much for the video. Do you know any good library for form validation in server side in next js such as express validator? Thanks Again

sumitdey-frontend
Автор

Hey Bruno... great video... only useful video content I can find on next-connect... I have a basic question, what is the best approach for using a query string embedded in the route url. say "drivers/:ID/record" how can I access the ID and still use the next.js routing?

andrewjackson
Автор

Please....how do implement this with Javascript and not typescript

codewithshedrack
Автор

Great tutorial! One nit-pick: Last error status should be 403, not 401, since a valid user was "logged in", just not access to post.

Svish_
Автор

Hello, Bruno. 2 days I've been watching ten videos and could not stop. I also read some of the comments and you were actively answering the questions or just response with love icon. I just want to say, THANK YOU. I clicked LIKE for every your videos.

alfieqashwa
Автор

I was having issue in error middleware using next-connect, searched for it like 4 or 5 hours but couldn't find any better solution and you just explained it in 5 minutes
thanks bruno :)

ammarkhan
Автор

Hey Bruno, do you know if web sockets (socket.io) can be used with the Next API routes without creating a custom express server? I'm having trouble finding info on it. Thanks!

jii
Автор

Ola Bruno, tudo bem? Sou do Brasil e acompanho seu vídeos há um bom tempo. Parabéns. Você poderia tirar uma dúvida para mim? Estou usando o Next-Connect em um projeto, fiz o handler separado em um arquivo, fiz o export default nextConnect<NextApiRequest, NextApiResponse>({}). Mas eu acho que fazendo assim aparentemente as rotas ficam meio "loucas". Eu chamo por exemplo /auth/users/[id].tsx (retornar um usuario), funciona, dai eu chamo a /auth/users (lista de usuarios), funciona também. Mas quando eu volto para a /auth/users/[id].tsx parece que o NextJS manteve algum cache da ultima url /auth/users, dai ele só fica chamando essa mesma /auth/users mesmo eu fazendo o GET para a /auth/users/[id].tsx. Você já teve esse problema? Eu consegui resolver retornando uma função do arquivo handler. Se ficou confuso me avise. Obrigado e parabéns novamente. Desculpe pelo texto grande ... klkkkk

LuizPauloCamargo
Автор

Hi Bruno,
I created a generic handler file which I import in my API files. However, I noticed doing that when I call 2 different API's

Sometimes on 2nd API, I get the response from the first API. What is the issue?

waleedshabbir
Автор

Hey Bruno, thanks so much for your great videos 👍
Will you create a tutorial of how to deploy the next js app? More specifically how to setup a database? I assume sqllite is great for local development, but for production you will need to switch to something else. Or...?

vladimirhooke
Автор

Thank you so much for this, Bruno!
Your videos are really great man ;)

rohitdalal
Автор

the next-connect readme says to use factory function instead of reusing same instance

export default function base() {
return nc().use(a).use(b);
}

markokraljevic