var express = require('express');
var app = express();

app.use("/", express.static(__dirname));

var products = [
  {id: 0, title: 'Farby', description: 'Pudełka pełne farb', price: 3.95},
  {id: 1, title: 'Sukienka w kropki', description: 'Kropki na sukience', price: 12.95},
  {id: 2, title: 'Kryształ górski', description: 'Niewielkie kryształki z gór, really', price: 6.95}
];

app.get('/products', function(req, res) {
  res.send(products);
});

app.get('/products/:id', function(req, res) {
  res.send(products[req.params.id]);
});

app.listen(3000);
console.log('Serwer nasłuchuje na porcie 3000');

