C POST
R GET
U PUT
D DELETE
- GET /api/v1/properties
_id img city size price
1 [1, 2] Riga 500 150000
2 [4] Jelgava 1000 200000
- POST /api/v1/properties
// reference: pages/api/v1/tweet.js
if (req.method === 'POST') {
const { property } = req.body;
db.collection('properties').insert({
userId: ObjectId(session.user._id),
images: [
"https://images.unsplash.com/photo-1512917774080-9991f1c4c750?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80",
"https://images.unsplash.com/photo-1513584684374-8bab748fbf90?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1946&q=80",
],
city: property.city,
size: property.size,
price: property.price,
});
res.send(201).end();
}
Seed: