1 | var connect = require('gulp-connect');
|
2 |
|
3 | module.exports = function (port)
|
4 | {
|
5 | return function()
|
6 | {
|
7 | var cors = function (req, res, next) {
|
8 | res.setHeader('Access-Control-Allow-Origin', '*');
|
9 | res.setHeader('Access-Control-Allow-Headers', '*');
|
10 | next();
|
11 | };
|
12 |
|
13 | return connect.server({
|
14 | livereload: false,
|
15 | root: process.cwd(),
|
16 | port: port,
|
17 | middleware: function () {
|
18 | return [cors];
|
19 | }
|
20 | });
|
21 | }
|
22 | };
|