<prompt> Unda seva ya Node.js Express yenye ncha mbili: moja ya kupakia picha JPEG au PNG na nyingine ya kurejesha picha zilizopakiwa kwa kitambulisho chao cha kipekee. Hifadhi picha katika saraka ya ndani kwa kutumia heshi zao za MD5 kama jina la faili. Weka kikomo cha ukubwa wa juu wa faili zinazopakiwa hadi KB500.PLINFORMAT  <response>: const express needexpress;const multer hitajimulter;const crypto needcrypto;const fs needfs;const path neednjia;const app express;const upload multervikomo: fileSize: 500 1024 ; Punguza ukubwa wa faili hadi KB 500 Unda saraka ya kuhifadhi picha ikiwa haipoconst imageDir picha;ikiwa !fs.existsSyncimageDir fs.mkdirSyncimageDir; Kazi ya kutengeneza heshi ya MD5 ya failifanya kazi md5Filefaili const buffer fs.readFileSyncfile.path; rudisha crypto.createHashmd5. sasishabuffer.digesthex; Pakia mwishoapp.postpakia, upload.singlepicha, req, res ikiwa !req.faili return res.status400.tumaHakuna faili iliyopakiwa.; const permitMimeTypes pichajpeg, imagepng; ikiwa !allowedMimeTypes.includesreq.file.mimetype fs.unlinkSyncreq.file.path; Futa faili ya muda return res.status400.sendAina ya faili si sahihi. JPEG na PNG pekee ndizo zinazoruhusiwa.; const md5hash md5Filereq.file; const ext path.extnamereq.file.originalname; const newPath path.joinimageDir, md5hash ext; fs.renameSyncreq.file.path, newPath; Sogeza faili ya muda kwa njia mpya res.send id: md5hash ;; Rejesha mwisho wa pichaapp.getimage:id, req, res const id req.params; const imagePathJpeg path.joinimageDir, id .jpeg; const imagePathPng path.joinimageDir, id .png; ikiwa fs.existsSyncimagePathJpeg res.sendFilepath.resolveimagePathJpeg; vinginevyo ikiwa fs.existsSyncimagePathPng res.sendFilepath.resolveimagePathPng; nyengine res.status404.tumaPicha haijapatikana.; ;const port process.env.PORT 3000;app.listenbandari, console.logSeva inayoendesha kwenye mlango wa port; 