@terungwa/

fela_modules

Nodejs

No description

fork
loading
Files
  • index.js
  • check_user_location.js
  • custom_payload.js
  • delivery_locations.js
  • prices_drinks_type.js
  • prices_food_type.js
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var http = require('http');
var price_food = require('./prices_food_type');
var price_drink = require('./prices_drinks_type');
var delivery_locations = require('./delivery_locations');
var check_user_location = require('./check_user_location');

var server = http.createServer(function(req, res){

  //write code here
  var food_price = price_food('CAT FISH PEPPER SOUP');
  var drink_price = price_drink('Malta Guiness');
  var restaurant_info = delivery_locations('Chopnownow', 'Yaba');
  
  
  let city = 'Yaba';
  let available_restaurants = check_user_location(city);
  
  if(typeof available_restaurants === 'object'){
    for (var i = 0; i < available_restaurants.length; i++) {
      // return list of available restaurants to customer
      console.log(available_restaurants);
      console.log(available_restaurants[i].logo);
    }
  }else{
    console.log(available_restaurants);
  }
  

});
server.listen(8001); 
node v10.16.0