Mr. Robot

Mr. Robot Contact information, map and directions, contact form, opening hours, services, ratings, photos, videos and announcements from Mr. Robot, Digital creator, .

في بعض الاحيان لما بتيجي تتدرب علي مشاريع front بتحتاج ل API وومكن تنشئ انت ال API دي باستخدام json serverبس ممكن تواجهك...
15/10/2023

في بعض الاحيان لما بتيجي تتدرب علي مشاريع front بتحتاج ل API وومكن تنشئ انت ال API دي باستخدام json server
بس ممكن تواجهك مشاكل وانت بتعمل deploy للمشروع بتاعك ان الAPI متعملوش deploy مع المشروع
انا جاي دلوقتي اعرفك ازاي تعمل deploy لل json server علي render cloud وتاخد endpoient او API Link تستخدمه في مشروعك
اول حاجه هتخش تعمل حساب مجاني علي render cloud باستخدام github
-----(https://render.com/)
تاني حاجه هتنشئ ال server باستخدام node js (اوعي تخاف)
بعد كده هتنزل json server
-----( npm i json-server ) اكتب الامر ده ف cmd
هتعمل فايل بسيط اسمه (db.json) ده اللي هيبق فيه الداتا
هتعمل فايل بسيط اسمه (server.js)
جوه الفايل ده هتعمل require لل json-server
-----const jsonServer = require('json-server')
وبعدين هتنشئ سيرفر
----- ()const server = jsonServer.create
هنعمل ربط او توجيه للسيرفر بملف الداتا اللي احنا عملناه (db.json)
const router = jsonServer.router('db.json')
طبعا محتاجين نخلي ال api متاح للاستخدام مع ال localhost او اي ip تاني
فهنعمل middlewares
-----()const middlewares = jsonServer.defaults
server.use(middlewares)
بعد كده هنعمل bath لل api
-----server.use('/api', router)
واخيرا هنعمل listen للسيرفر
-----server.listen(process.env.PORT || 5000, () => {
console.log('JSON Server is running')
})
تقدر تشوف الملفات هنا
-----https://github.com/hesham156/JSON-SERVER
بعد متخلص الكود هتبدا تعمل repositorie علي github وترفع عليها الكود بتاعك
اخيرا هتروح علي render وتعمل new ==> web service
هتختار ال repositorie
وتسمي المشروع بتاعك (https://*THENAME*.onrender.com)
وتعمل deploy
ومبروك عليك API تقدر تستخدمه في اي مكان

Address


Telephone

+201227728001

Website

Alerts

Be the first to know and let us send you an email when Mr. Robot posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Contact The Business

Send a message to Mr. Robot:

Shortcuts

  • Address
  • Telephone
  • Alerts
  • Contact The Business
  • Claim ownership or report listing
  • Want your business to be the top-listed Media Company?

Share