Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private loggerUrl = 'localhost:3039/read/getall/';
- getLoggerData(): Promise <Dataset[]> {
- return this.http.get(this.loggerUrl)
- .toPromise()
- .then(response => response.json().data as Dataset[])
- .catch(this.handleError);
- }
- var app = express();
- app.use(function (req, res, next) {
- //Website you wish to allow to connect
- res.setHeader('Access-Control-Allow-Origin', 'http://localhost:3035');
- // Request methods you wish to allow
- res.setHeader('Access-Control-Allow-Methods',
- 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
- // Request headers you wish to allow
- res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
- // Set to true if you need the website to include cookies in the requests sent
- // to the API (e.g. in case you use sessions)
- res.setHeader('Access-Control-Allow-Credentials', true);
- // Pass to next layer of middleware
- next();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement