<prompt> Tengeneza programu ya Node.js inayotumia Express.js na kuingiliana na hifadhidata ya PostgreSQL ili kudhibiti mfumo msingi wa blogu. Programu inapaswa kusaidia kuunda, kusoma, kusasisha, na kufuta machapisho ya blogi, pamoja na kuongeza maoni kwa machapisho yaliyopo.PLINFORMAT  <response>: const express needexpress;const bodyParser needbody-parser;const app express;const port process.env.PORT 3000;const pgp needpg-promise;needdotenv.config;const db pgpprocess.env.DATABASE_URL;const router express.Router ;app.usebodyParser.json;app.usebodyParser.urlencodediliyopanuliwa: kweli ; Njiaapp.useapi, kipanga njia;app.listenbandari, console.logSeva inafanya kazi kwenye bandari port;; Pata machapisho yoterouter.getposts, async req, res jaribu const posts subiri db.anyCHAGUA KUTOKA machapisho ORDER BY created_at DESC; res.jsonmachapisho; kukamata kosa res.status500.json kosa: Hitilafu imetokea wakati wa kuleta machapisho ; ; Pata chapisho moja kwa kitambulishorouter.getposts:id, async req, res jaribu const postId parseIntreq.params.id; const post subiri db.oneCHAGUA KUTOKA machapisho WAPI id 1, postId; res.jsonchapisho; kukamata kosa res.status404.jsonkosa:Chapisho halijapatikana ; ; Unda chapisho jipyarouter.postposts, async req, res jaribu const title, content req.body; const result subiri db.one INGIZA KWENYE machapishokichwa, maudhui THAMANI1, 2 INAYOREJESHA , kichwa, yaliyomo ; hali.hali201.jsonmatokeo; kukamata kosa res.status400.json kosa: Hitilafu ilitokea wakati wa kuunda chapisho ; ; Sasisha chapisho lililoporouter.putposts:id, async req, res jaribu const postId parseIntreq.params.id; const title, content req.body; const result subiri db.one SASISHA machapisho WEKA kichwa 1, maudhui 2 WHERE id 3 INAREJESHA , kichwa, maudhui, kitambulisho cha posta ; res.jsonmatokeo; kukamata kosa res.status400.json kosa: Hitilafu imetokea wakati wa kusasisha chapisho ; ; Futa chapishorouter.deleteposts:id, async req, res jaribu const postId parseIntreq.params.id; await db.noneFUTA KUTOKA KWA machapisho WAPI id 1, postId; hali.asili204.tuma; kukamata kosa res.status400.json kosa: Hitilafu ilitokea wakati wa kufuta chapisho ; ; Pata maoni kwa chapishorouter.getposts:idcomments, async req, res jaribu const postId parseIntreq.params.id; const comments subiri db.any CHAGUA KUTOKA kwa maoni WAPI post_id 1 ORDER BY created_at DESC, postId ; res.jsonmaoni; kukamata kosa res.status500.json kosa: Hitilafu imetokea wakati wa kuleta maoni ; ; Ongeza maoni kwa chapishorouter.postposts:idcomments, async req, res jaribu const postId parseIntreq.params.id; const mwandishi, maudhui req.body; const result subiri db.one INGIZA KWENYE maonikitambulisho_cha_chapisho, mwandishi, maudhui THAMANI1, 2, 3 ZINAREJEA , Id, mwandishi, maudhui ; hali.hali201.jsonmatokeo; kukamata kosa res.status400.json kosa: Hitilafu ilitokea wakati wa kuongeza maoni ; ; 