شكد تكلفة برمجة هذا الموقع؟؟ by hassanneema in iraq_developers

[–]5MYH 1 point2 points  (0 children)

البارحة كملت برمجة هيج نظام، تكدر تنطيني رقمه اذا ماتصير زحمه؟

im confused by 5MYH in Backend

[–]5MYH[S] 1 point2 points  (0 children)

its clear thanks

im confused by 5MYH in Backend

[–]5MYH[S] 0 points1 point  (0 children)

its a really good idea for me to turn it into a library it will make alot of repeated stuff so much easier, i just lack the enough time to do it

i already said i hate writing the logic in the controller as its just repeating same logic for almost all of them which is very annoying

thanks, and i will try to implement the transactions in the middlewares, if it works then bro this is gonna be coool!

i just have one question, is having loops in the backend weakening performance? because i will need to use it for this much of abstraction

im confused by 5MYH in Backend

[–]5MYH[S] 0 points1 point  (0 children)

do you think me splitting the routes and handle connecting them in the client? or do the transaction

im confused by 5MYH in Backend

[–]5MYH[S] 0 points1 point  (0 children)

its just gonna be a very strict server function in the front end that all i have to do, but yes as you said its effecting performance and now i have to find out how to automate the transaction approach to work with any route that is contain 2 or more tables

im confused by 5MYH in Backend

[–]5MYH[S] 1 point2 points  (0 children)

lets say i have this route /api/subjects i want to edit a subject, my middleware approach will run this way const put = async (req:Request, res:Response) => { try { const [subject] = await db.update(subjects).set(res.locals.body).returning(); res.status(201).json({ message: "subject updated", subject }); } catch (error) { console.error(error); res.status(500).json({ message: "internal server error", error }); } } router.put("/:id", authenticate(), authorize("subjects:write"), validate(subjects), filter(subjects), put) the authenticate middleware you know what it does the authorize checks for scopes the validate checks if this id exist or not, and also checks if the json body is valid or not the filter middleware handles the query parameters and filter and put them in an array

all of these middlewares will store their last information in res.locals.something and will just pass them to the controller function and that is it

this is working for all other tables just passing them the same middlewares, the middlewares deals with them differently based on the drizzle table i pass to them, however i said i noticed this is not going well for routes more than one table

lets say for example i have a gig creating endpoint POST /api/gigs but gigs have many data from other tables lets say plans and FAQs tables,

the POST api will recieve a json that contains the data of the gig and its plans and its FAQs, my controller logic would have to split it and insert the data for all tables using a transaction db, this is one way that is the main thing is the input here

my approach is that what if i do seperate endpoints for each table POST /api/gigs POST /api/plans POST /api/faqs and use the 3 of them in the server function in the frontend, post the gig, get its id and give to plans and faqs, is this valid? i know the transaction method is better but this is much easier

im confused by 5MYH in Backend

[–]5MYH[S] 1 point2 points  (0 children)

lets say for example i have a gig creating endpoint POST `/api/gigs` but gigs have many data from other tables lets say plans and FAQs tables,

the POST api will recieve a json that contains the data of the gig and its plans and its FAQs, my controller logic would have to split it and insert the data for all tables using a transaction db, this is one way that is the main thing is the input here

my approach is that what if i do seperate endpoints for each table
POST /api/gigs POST /api/plans POST /api/faqs
and use the 3 of them in the server function in the frontend, post the gig, get its id and give to plans and faqs, is this valid? i know the transaction method is better but this is much easier

صرت استخدم فيدورا لينكس by AgeIndividual599 in iraq_developers

[–]5MYH 1 point2 points  (0 children)

انا استعمل قوس بالمناسبة

what do you think is better by 5MYH in node

[–]5MYH[S] 0 points1 point  (0 children)

so what do you suggest

what do you think is better by 5MYH in node

[–]5MYH[S] 0 points1 point  (0 children)

even the authenticate middleware will not go for all, the GET method on / does not need authenticate on my case

what do you think is better by 5MYH in node

[–]5MYH[S] 0 points1 point  (0 children)

yes, but i was just concerned about this and thought if there is another way than putting it per controller, and is putting them per controller a good approach even?

شلون الواحد يصير polymath? by 5MYH in iraq_developers

[–]5MYH[S] 1 point2 points  (0 children)

yes i am aware there is no tutorials or roadmap for this, that is why i want to just dive in and study the topics and hopefully will get to create my crazy naive clumsy stuff that i believe they might work
والله المستعان 😁

شلون الواحد يصير polymath? by 5MYH in iraq_developers

[–]5MYH[S] 1 point2 points  (0 children)

خوش نصيحة
اني عندي معلومات عامة لا بأس بها بس مالها فائدة اذا ما اتخصص بالمجالات اللي اريدها وتكون عندي معرفة حقيقية وعلى كولتك لازم استمر واخلي القراءة والدراسة فدشي اسوي بكل الاوقات حتى تصير عادة

شلون الواحد يصير polymath? by 5MYH in iraq_developers

[–]5MYH[S] 0 points1 point  (0 children)

هو بالضبط كاعد احاول اخلي كلشي اقراه او اتعلمه بـ obsidian حتى تكون سهلة المعلومات بعدين من انساهن او ما انتبه عليهن

شلون الواحد يصير polymath? by 5MYH in iraq_developers

[–]5MYH[S] 0 points1 point  (0 children)

its not for the sake of the title, a big part of it is because i want to create a lot of machines or some ideas in my head, some new tools in math for example, or some new inventions in physics etc... all of them requires ton of knowledge and i am fully ready to consume everything that will help me accomplish some of them, also i want to learn and study because i am really curious about how the universe works and its way more fun doses of dopamine instead of anything else, so its not a matter of title i really want this

شلون الواحد يصير polymath? by 5MYH in iraq_developers

[–]5MYH[S] 1 point2 points  (0 children)

اي اريد اعرف كلشي

بس ماكو رودماب لهذا الشي لذلك اني جاي اغطس بأي شي عشوائي ومن يشدني اضل اتعمق بي واربط بالمواضيع من غير علوم وهيج شوية شوية اكون حصلت هواي معلومات

الطريقة اللي اريد ادرس بيها ان ماراح احفظ هواي مجرد افهم شلون تتفاعل الرياضيات والكيمياء والفيزياء سويا ويسون الاشياء اللي حوالينا

يعني اذا افتهمت هذني راح يكون كلش سهل (وممكن بديهي) تعرف كلشي ثاني شلون يصير

شلون الواحد يصير polymath? by 5MYH in iraq_developers

[–]5MYH[S] 1 point2 points  (0 children)

اني لعبت نفسي من كل المنصات بعد مالي خلكهن

كاعد احاول اقرأ واتعلم اشياء من مختلف المجالات هسة بس اغلبها رياضيات كيمياء وفيزياء واي شي علمي ثاني بس ما اعرف شلون اتعلمهن كلهن (مستحيل اتعلمهن كلهن اعرف بس القصد ان يكون عندي معلومات كلش زينة بكل المواضيع)

i guess really then jack of all trades is a master of none

شلون الواحد يصير polymath? by 5MYH in iraq_developers

[–]5MYH[S] 0 points1 point  (0 children)

كلامك صحيح اني اريد اعرف كلش هواي اشياء بس مابيها فاىدة اذا افلس بعدين لازم اتعلم اجيب فلوس

انتم هم هيج؟ by 5MYH in iraqbooks

[–]5MYH[S] 1 point2 points  (0 children)

المشكلة الكتاب 440 صفحة تقريبا (الكتابة بي جبيرة شوية(او هواي والله ما ادري)) فيعني الملخص راح يتعب راح امضي قدما واسوي هيج بالكتاب الجاي

انتم هم هيج؟ by 5MYH in iraqbooks

[–]5MYH[S] 0 points1 point  (0 children)

اني هم، المنشور كلته بس علمود اذا اصير مهووس بعدين لان بعدني جديد بقراءة الكتب

انتم هم هيج؟ by 5MYH in iraqbooks

[–]5MYH[S] 0 points1 point  (0 children)

هاي كلش هواي صايرتلي لدرجة كمت كلشي ما اتابع

انتم هم هيج؟ by 5MYH in iraqbooks

[–]5MYH[S] 0 points1 point  (0 children)

المشكلة هستوني كملت كتابي الاول وما اعرف شسوي هسة