Guest User

Untitled

a guest
May 23rd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. module.exports = {
  2. ipAddress: "http://localhost:8080"
  3. }
  4.  
  5. var config = require("../../config.js");
  6.  
  7. router
  8. .get('/', function (req, res) {
  9. var html = `
  10. <div class="content">
  11. <a href="${config.ipAddress}/orders">Orders</a>
  12. <a href="${config.ipAddress}/invoices">Invoices</a>
  13. </div>
  14. `
  15. res.send(html);
  16. });
  17.  
  18. module.exports = router;
  19.  
  20. module.exports = {
  21. ipAddress: "http://255.255.255.255"
  22. }
  23.  
  24. var ipAddress = "http://localhost:8080"; // To be changed into "http://255.255.255.255"
  25.  
  26. function placeOrder() {
  27. fetch(`${ipAddress}/place-order`, {
  28. method: "POST",
  29. headers: {
  30. "Accept": "application/json",
  31. "Content-type": "application/json"
  32. }
  33. })
  34. .then((res) => res.json())
  35. .then((data) => xonsole.log(data))
  36. .catch((err) => console.log(err));
  37. }
  38.  
  39. document.getElementById("submit-order").addEventListener("click", () => placeOrder());
Add Comment
Please, Sign In to add comment