25 lines
581 B
JavaScript
25 lines
581 B
JavaScript
'use strict';
|
|
|
|
const express = require('express');
|
|
const bodyParser = require('body-parser');
|
|
const app = express();
|
|
app.use(bodyParser.json());
|
|
app.use(express.static('./'));
|
|
|
|
app.get('/api/cart', getCart);
|
|
app.post('/api/cart/order', handleOrder);
|
|
|
|
app.listen(3000, () => console.log('running at: http://localhost:3000'));
|
|
|
|
function getCart(req, resp) {
|
|
resp.set('Content-Type', 'application/json');
|
|
resp.end("");
|
|
}
|
|
|
|
function handleOrder(req, resp) {
|
|
resp.set('Content-Type', 'application/json');
|
|
var order = req.body;
|
|
console.log(order);
|
|
resp.end("");
|
|
}
|