diff --git a/CommBank-Server/Secrets.json b/CommBank-Server/Secrets.json index 0e5bf949..9933ccf3 100644 --- a/CommBank-Server/Secrets.json +++ b/CommBank-Server/Secrets.json @@ -1,5 +1,5 @@ { "ConnectionStrings": { - "CommBank": "{CONNECTION_STRING}" + "CommBank": "{mongodb+srv://talharana:qwertyfgzx@cluster0.ytm93zz.mongodb.net/?appName=Cluster0}" } -} \ No newline at end of file +} diff --git a/CommBank-Server/client request b/CommBank-Server/client request new file mode 100644 index 00000000..52007394 --- /dev/null +++ b/CommBank-Server/client request @@ -0,0 +1,24 @@ +const express = require('express'); +const app = express(); +app.use(express.json()); + +let user = { + id: 1, + name: 'John', + icon: '😊' +}; + +app.get('/api/user', (req, res) => { + res.json(user); +}); + +app.put('/api/user/icon', (req, res) => { + const { icon } = req.body; + if (!icon) { + return res.status(400).json({ error: 'Icon is required' }); + } + user.icon = icon; + res.json({ success: true, icon }); +}); + +app.listen(5000, () => console.log('Server running on port 5000'));