-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc13ee5
commit 7bfbc26
Showing
10 changed files
with
304 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const express = require('express'); | ||
const app = express(); // framework to create server | ||
const port = 8080; | ||
|
||
// Serve the JSON file | ||
app.get('/', (req, res) => { | ||
// Path to the JSON file | ||
|
||
// Set the appropriate Content-Type header | ||
res.setHeader('Content-Type', 'application/json'); | ||
|
||
// Send the JSON file | ||
res.sendFile(__dirname + '/data/products.json'); | ||
}); | ||
|
||
|
||
|
||
// Start the server | ||
app.listen(port, () => { | ||
console.log(`Server is running on port ${port}`); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const net = require('net'); | ||
|
||
// Create a TCP socket and connect to the server | ||
const client = new net.Socket(); | ||
client.connect(3000, 'localhost', () => { | ||
console.log('Connected to server.'); | ||
}); | ||
|
||
// Handle data received from the server | ||
client.on('data', data => { | ||
console.log(`Received data from server: ${data}`); | ||
|
||
// You can perform further actions with the received data here | ||
}); | ||
|
||
// Handle server disconnection (optional) | ||
client.on('close', () => { | ||
console.log('Server connection closed.'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
[ | ||
{ | ||
"id": 0, | ||
"name": "APPLE iPhone SE", | ||
"color":"Black", | ||
"ROM": 128, | ||
"price": 990, | ||
"modeName": "iPhone SE", | ||
"modelNumber": "MHGT3HN/A", | ||
"size": "11.94 cm (4.7 inch) Retina HD Display", | ||
"camera": "12MP Rear Camera | 7MP Front Camera", | ||
"Description": "Widescreen HD LCD Retina Multi-touch IPS Display (1400:1 Contrast Ratio (Typical), True Tone Display, Wide Color Display (P3), Haptic Touch, 625 nits Max Brightness (Typical), Fingerprint-resistant Oleophobic Coating, Display Zoom, Reachability)", | ||
"productImage":"http://atlas-content-cdn.pixelsquid.com/stock-images/iphone-x-smartphone-xwVXQLD-600.jpg" | ||
}, | ||
{ | ||
"id": 1, | ||
"name": "APPLE iPhone XR", | ||
"color":"White", | ||
"ROM": 64, | ||
"price": 790, | ||
"modeName": "iPhone XR", | ||
"modelNumber": "MH6N3HN/A", | ||
"size": "15.49 cm (6.1 inch) Display", | ||
"camera": "12MP Rear Camera | 7MP Front Camera", | ||
"Description": "1400:1 Contrast Ratio (Typical), True Tone Display (Six-channel Light Sensor), Wide Colour Display (P3), 625 nits Maximum Brightness (Typical), Fingerprint-resistant Oleophobic Coating, Support for Display of Multiple Languages and Characters Simultaneously, Liquid Retina HD Display, Tap to Wake, Wide Colour Gamut", | ||
"productImage":"https://c8.alamy.com/zooms/6/e98284ded5444c08949d7fd9f2bae166/2cd68c5.jpg" | ||
}, | ||
{ | ||
"id": 2, | ||
"name": "APPLE iPhone 11", | ||
"color":"White", | ||
"ROM": 64, | ||
"price": 740, | ||
"modeName": "iPhone 11", | ||
"modelNumber": "MHDC3HN/A", | ||
"size": "15.49 cm (6.1 inch) Liquid Retina HD", | ||
"camera": "12MP + 12MP | 12MP Front Camera", | ||
"Description": "1400:1 Contrast Ratio (Typical), True Tone Display, Wide Colour Display (P3), Haptic Touch, 625 nits Max Brightness (Typical), Fingerprint Resistant Oleophobic Coating, Support for Display of Multiple Languages and Characters Simultaneously", | ||
"productImage":"https://png.pngtree.com/png-vector/20201230/ourlarge/pngtree-smart-phone-vector-3d-style-mobile-design-mockup-png-image_2679535.jpg" | ||
}, | ||
{ | ||
"id": 3, | ||
"name": "APPLE iPhone XR", | ||
"color":"Yellow", | ||
"ROM": 128, | ||
"price": 999, | ||
"modeName": "iPhone XR", | ||
"modelNumber": "MHDC4HN/A", | ||
"size": "15.49 cm (6.1 inch) Liquid Retina HD", | ||
"camera": "12MP + 12MP | 12MP Front Camera", | ||
"Description": "1400:1 Contrast Ratio (Typical), True Tone Display, Wide Colour Display (P3), Haptic Touch, 625 nits Max Brightness (Typical), Fingerprint Resistant Oleophobic Coating, Support for Display of Multiple Languages and Characters Simultaneously", | ||
"productImage":"https://png.pngtree.com/png-vector/20201230/ourlarge/pngtree-vector-3d-style-smart-phone-mockup-design-png-image_2679529.jpg" | ||
}, | ||
{ | ||
"id": 4, | ||
"name": "APPLE iPhone 12 Mini", | ||
"color":"Purple", | ||
"ROM": 64, | ||
"price": 720, | ||
"modeName": "iPhone 12", | ||
"modelNumber": "MGJE3HN/A", | ||
"size": "13.72 cm (5.4 inch) Super Retina XDR Display", | ||
"camera": "12MP + 12MP | 12MP Front Camera", | ||
"Description": "Dive into a world of crystal-clear visuals with the Super Retina XDR Display of the iPhone 12 Mini. This beast of a smartphone packs the A14 Bionic chip to make for blazing-fast performance speeds. On top of that, its Dual-camera System, along with Night Mode, helps you click amazing pictures and selfies even when the lighting isn’t as good as you’d want it to be.", | ||
"productImage":"https://cdn1.vectorstock.com/i/1000x1000/70/05/realistic-frameless-smartphone-mock-up-3d-vector-33107005.jpg" | ||
}, | ||
{ | ||
"id": 5, | ||
"name": "APPLE iPhone 11", | ||
"color":"Red", | ||
"ROM": 128, | ||
"price": 990, | ||
"modeName": "iPhone 11", | ||
"modelNumber": "MHDC3HN/A", | ||
"size": "15.49 cm (6.1 inch) Liquid Retina HD", | ||
"camera": "12MP + 12MP | 12MP Front Camera", | ||
"Description": "1400:1 Contrast Ratio (Typical), True Tone Display, Wide Colour Display (P3), Haptic Touch, 625 nits Max Brightness (Typical), Fingerprint Resistant Oleophobic Coating, Support for Display of Multiple Languages and Characters Simultaneously", | ||
"productImage":"https://previews.123rf.com/images/barmaleeva/barmaleeva2003/barmaleeva200300004/141800762-white-realistic-smartphone-mockup-3d-mobile-phone-with-blank-white-screen-modern-vector-cell-phone-t.jpg" | ||
}, | ||
{ | ||
"id": 6, | ||
"name": "APPLE iPhone SE", | ||
"color":"White", | ||
"ROM": 64, | ||
"price": 780, | ||
"modeName": "iPhone SE", | ||
"modelNumber": "MHGT3HN/A", | ||
"size": "11.94 cm (4.7 inch) Retina HD Display", | ||
"camera": "12MP Rear Camera | 7MP Front Camera", | ||
"Description": "Widescreen HD LCD Retina Multi-touch IPS Display (1400:1 Contrast Ratio (Typical), True Tone Display, Wide Color Display (P3), Haptic Touch, 625 nits Max Brightness (Typical), Fingerprint-resistant Oleophobic Coating, Display Zoom, Reachability)", | ||
"productImage":"http://atlas-content-cdn.pixelsquid.com/stock-images/iphone-x-smartphone-xwVXQLD-600.jpg" | ||
}, | ||
{ | ||
"id": 7, | ||
"name": "APPLE iPhone 12", | ||
"color":"Blue", | ||
"ROM": 64, | ||
"price": 780, | ||
"modeName": "iPhone 12", | ||
"modelNumber": "MHGT3HN/A", | ||
"size": "11.94 cm (4.7 inch) Retina HD Display", | ||
"camera": "12MP Rear Camera | 7MP Front Camera", | ||
"Description": "Widescreen HD LCD Retina Multi-touch IPS Display (1400:1 Contrast Ratio (Typical), True Tone Display, Wide Color Display (P3), Haptic Touch, 625 nits Max Brightness (Typical), Fingerprint-resistant Oleophobic Coating, Display Zoom, Reachability)", | ||
"productImage":"https://cdn1.vectorstock.com/i/1000x1000/70/05/realistic-frameless-smartphone-mock-up-3d-vector-33107005.jpg" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,9 @@ | |
"express": "^4.18.2", | ||
"json-server": "^0.17.3" | ||
} | ||
|
||
|
||
|
||
} | ||
|
||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.