all files / generators/api/config/ cors.js

100% Statements 8/8
100% Branches 0/0
100% Functions 3/3
100% Lines 8/8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23                             
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Class which generates string content for cors.js configuration file
 *
 * @export
 * @class Cors
 */
var Cors = (function () {
    function Cors() {
    }
    /**
     * Get cors.js configuration file string content
     * @return {string} - string generated content
     */
    Cors.prototype.getCorsConfig = function () {
        return "module.exports = (request, response, next) => {\n    response.header('Access-Control-Allow-Origin', '*');\n    response.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');\n    response.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');\n\n    next();\n};";
    };
    return Cors;
}());
exports.Cors = Cors;
exports.default = new Cors();