Name: Tal Davidi
Date: April 29th, 2017
Project Topic: A website for listing room-swap requests facilitated by exchange of money.
URL: https://ter.ps/underground
Data point fields:
Listing
Field 1
: GenderType
: StringField 2
: Listing PriceType
: NumberField 3
: Hall NameType
: StringField 4
: Number of RoomsType
: NumberField 5
: Free SpotsType
: [RoomOpening]Field 6
: Room NumberType
: NumberField 7
: BathroomsType
: NumberField 8
: Contact PointType
: String
RoomOpening
Field 1
: VacanciesType
: NumberField 2
: Total BedsType
: Number Schema:
Listing: {
gender: {
type: String,
required: true
},
price: {
type: Number,
required: true
},
hallName: {
type: String,
required: true
},
numberOfRooms: {
type: Number,
required: true
},
freeSpots: {
type: [RoomOpening],
required: true
},
roomNumber: {
type: String,
required: true
},
bathrooms: {
type: Number
required: true
}
}
RoomOpening: {
vacancies: {
type: Number,
required: true
},
totalBeds: {
type: Number,
require: true
}
}
HTML form route: /list
POST endpoint route: /api/newListing
Example Node.js POST request to endpoint:
var request = require("request");
var options = {
method: 'POST',
url: 'http://localhost:3000/api/...',
headers: {
'content-type': 'application/x-www-form-urlencoded'
},
form: {
gender: 'male',
price: '100',
hallName: 'Centreville',
numberOfRooms: '2',
roomNumber: '123',
bathrooms: '0',
'leaving-1': '2',
'beds-1': '4',
'leaving-2': '2',
'leaving-2': '2'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
GET endpoint route: /api/getListings
Search Field: Hall Name
Navigation Filters
- Community Name ->
/community/:communityName
- Random Listing ->
/random
- Top Halls ->
/popular
- Cheapest ->
/cheapest
- Most Expensive ->
/expensive