Guest User

Untitled

a guest
Nov 23rd, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. const express = require('express');
  2. const bodyParser = require('body-parser');
  3. const app = express();
  4. var sql = require('mssql');
  5.  
  6. app.use(bodyParser.json());
  7. app.use(bodyParser.urlencoded({ extended: false }));
  8.  
  9. app.all("/*", function (req, res, next) {
  10. res.header('Access-Control-Allow-Origin', '*');
  11. res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
  12. res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With');
  13. next();
  14. });
  15.  
  16.  
  17. app.listen(1433, function () { console.log('Example app listening on port 1433!') })
  18.  
  19. var config = {
  20. server: "T21DOPD1",
  21. database: "ARGYLE_COMPARE",
  22. user: "dop_adm",
  23. password: "dopadm",
  24. port: 1433
  25. };
  26.  
  27. app.post('/ping', function (req, res) {
  28. res.send(res.body);})
  29.  
  30. this.appService.http.post('http://localhost:1433/ping', getAll, { headers: Headers })
  31. .subscribe(data => {
  32. console.log(data), (err) => console.error("Failed! " + err);
  33. })
Add Comment
Please, Sign In to add comment