ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก
Building a RESTful API with Cloud Functions and Firestore - CRUD OPERATTIONS For Beginners
ฝัง
- เผยแพร่เมื่อ 5 ส.ค. 2024
- In this FREE training, I will show you how simple it is to create a fully function RESTFULL API Services using , Firebase Cloud Functions.....👇
Source Links:
..........
Project File:
GitHub:- github.com/Vetrivel-VP/cloudF...
Follow us on:
codewithvetri.web.app/
Follow us on:
codewithvetri.web.app/
---------------------------------------------------------------------------------------------------------------------
Suggested Videos
React Dashboard - • ReactJS Tutorial for B...
Animated Landing Page : • Animated Fashion Desig...
Bootstrap 5 : Full Screen Image Background : • Bootstrap 5 : Full Scr...
Sliding Sign In & Sign Up Form | Rsponsive : • Sliding Sign In & Sign...
Glassmorphism | Neumorphism : • Glassmorphism | Neumor...
---------------------------------------------------------------------------------------------------------------------
Social Media:
Facebook:
/ velvetri452
Instagram:
@vetrivel_ravi
Linkedin:
/ velvetri
---------------------------------------------------------------------------------------------------------------------
Music :-
Song: Atch - Echoes
Music provided by Vlog No Copyright Music.
Creative Commons - Attribution 3.0 Unported
Video Link: • Atch - Echoes (Vlog No...
Chapters
00:00 - Intro
01:42 - Project Setup
12:59 - Configurations
16:16 - Configuring Security Key
18:20 - Creating App
22:54 - Creating API Create - POST
33:48 - Fetching Specific Data - GET
38:46 - Fetch All Data - GET
45:45 - Update Data - PUT
50:21 - Delete Data - DELETE
52:30 - Deploying API
Incredible video, thank you very much I was able to follow everything. Very concrete and useful, you rock.
Finally it wooorks! Thank you very much for great tutorial!
dude! finally I found the tutorial I was looking for, I love your explanations. Thank you so much!
Glad I could help!
this was super helpful, couldn't find a lot of this info anywhere until this video.
Glad you enjoyed it!
Great tutorial for REST API with Firebase. Keep doing great things bro! 👊🔥
Thanks, will do!
Thanks for the video, helped me to understand and do first deploy to firebase, I needed some light/easy to set up backend over my NextJS app, works perfectly fine.
Glad it helped!
Thank you! you helped me out a lot keep up the good work!
Glad I could help!
thank you brother crystal clear explanation
Hi dude, thanks! you are the best!
You're my hero. Thank you!
Glad I could help
its a great tutorial all concepts cleared
Thank you for this video, it's perfect!
You're very welcome!
You're a great teacher !
Thank you! 😃
best best video till now thankuu bro for this awsom tutorial
Excellent Work Vetri
I am so happy i found this...
Glad u love it
Thank you very much for that tutorial bro, You help me very much 😉
Glad to hear that
maybe god always bless you, thnks for help 🙏
best video
Great video! Maybe the best I ever saw for Firestore API usage. But here 3:07 I don't understand one thing. I have so or so to switch later in production mode, if I want to use my API in commercial projects. Wich code should have the rules block , so I can use the API ?
This was a great tutorial, however, I got all the way to deploy without issues, but when I run 'firebase deploy' I get an error - if I rerun it then sometimes it successfully deploys in terminal, but on the console it still says function deployment failed - any ideas?
Hi Vetri, thanks for this awesome video. It would be great if you can tell us how to handle relationship between the collections using the REST API using Cloud Functions. For example, connecting Students to the Teacher. and querying students of a teacher using REST API URL Params. Thanks.
Hi can you please elaborate your question.......
he means to say when he has more than one db one for teacher one for student and they connected with each other through some ids so how to manage this i Think@@VetrivelRavi
Handling relationships between collections using REST API and Cloud Functions is a common and important use case. To connect Students to a Teacher, you can structure your Firestore database like this:
Create a 'Teachers' collection where each document represents a teacher, and each document contains information about the teacher.
Create a 'Students' collection where each document represents a student, and each document contains information about the student. Additionally, you can include a field that links each student to a teacher, such as a 'teacherId' field.
When creating or updating a student's information, be sure to include the 'teacherId' field to indicate their relationship with a specific teacher.
Once I deployed the api successfully, when I try to go to my post route using insomnia, I get a google signin page. Why is this happening? I also have a couple of questions - does the app only fire up when an endpoint is hit? So is this a slower way than just doing the crud operations through the application itself instead of hitting endpoints in the functions api? Just wondering because I have three apps using the same firestore database so I thought having all the curd operations in one place (a firebase function api) would simplify it. But, if it slows it down that would be a problem.
👍👌🤩✌️
will u plz make trigger function like onDocumentCreated onDocumentUpdated onDocumentDeleted batch write etc in nodejs
if i need to make some attribute required how should i do ? ( for example i need to make the user name required )
thanks for the good tuto
That we can do it on client side itself
Thanks for the detailed tutorial!
One question, is it possible to pass a query parameters as such?
'api/getAll?id=123456'
you do the following
app.get("/api/getUser/:userId",(req, res) => {
const userId = req.params.userId;
--------- your code here -------
});
While calling : localhost:3500/api/getUser/102114
please sir i have some question 1-please add another video means add auth and user roles management to this article.. 2-which better to more search request realtime db or firestore db depending on price loots of thanks for your best tutorial.............
Noted...I try make this video simple as possible only because for beginners its easy to understand. On upcoming video all the features will be included....
@@VetrivelRavi Bro we're still waiting for auth ...following this
Thanks for you explanation. Can you add user profile to this API?
Yes you can!.....That will be saved in the firebase authentication tab.....from there we need to access those details
The video i was looking for, nice. Let me ask you something, i am running 'firebase login' command but a i got an error of 'Not a command" or something. Do you have to install something before you run 'firebase login' and 'firebase init'? Thanks
install firebase-admin-tools package
@@VetrivelRavi Thanks Ravi, i finished the video and it was a great introduction to what i needed to learn. It would've been nice if you would've added another end point in order to get docs from a collection that matches a specific criteria. Example: 'Get all users from a specific city', 'Get all orders from a specific customer' etc etc. But again, super thanks for the value of this video....
Glad you enjoyed it...I will prepare one video soon
ui: Fatal error occurred:
Emulator UI has exited: Error: spawn node ENOENT,
stopping all running emulators
Getting this after npm run serve
How can I upload a file or image within the sent data please help
I want to create an item consisting of a personal photo, name and phone number
That has to be done on the frontend......From the front end we will upload the image and pass the downloadurl of the image or a file to the backend.....
hello, i got an error message after follow the instruction in creating app, the error message said that was an internal server error status code 500. how to solve this?
this might happens only if you server code having some errors.....please do check the place where we are creating our server app
sir i am getting eslint error while writing async function how to fix it?
You need updated the eslint file or recreate the functions without eslint
You don't really need to set the Id using the date, Firebase will create a unique ID
Yes....But I dont want to use that, I need to use my own ID for my own reference in the front end
ggwp b ro
Brother frontend
That's just a back end brother..You can use it as an API to access it int front end
@@VetrivelRavi ok thanks bhaiya
Tamila bro ??
for some reason, the async function on line 28 keeps giving me a parsing error:
app.post("/api/create", (req, res) => {
(async () => {
try {
await db.collection("userDetails").doc(`${Date.now()}`).create({
id : Date.now(),
name : req.body.name,
phone : req.body.phone,
address : req.body.address
});
return res.status(200).send({status : "Sucess" , msg: "Data Saved"});
} catch(error){
console.log(error)
return res.status(500).send({ status: "Failed", msg: error });
}
})();
});
are you using es7? when I switch that, its gone but then the function times out.
I firgured it out, I had change my parser options in .jslint because I'm using node 18 and ECMAScript 10
I am not sure, please do share me the exact error code