hinos-cors
v1.0.2
Published
Cross-Origin Resource Sharing(CORS) for hinos
Downloads
8
Readme
hinos-cors
Cross-Origin Resource Sharing(CORS) for hinos A plugin help resolve cross domain for XHR request
Install
npm i hinos-cors -S
Examples
Typescript
import { Server } from 'hinos';
import { route } from 'hinos-route';
import { serve } from 'hinos-serve';
import { cors } from 'hinos-cors';
Server.use(serve({
'/upload': path.join(__dirname, '..', 'assets', 'upload')
}));
Server.use(cors());
Server.use(route(path.join(__dirname, 'controller')));
Javascript
const hinos = require("hinos");
const hinosRoute = require("hinos-route");
const hinosServe = require("hinos-serve");
const hinosCors = require("hinos-cors");
hinos.Server.use(hinosServe.serve({
'/images': path.join(__dirname, 'path to folder which contains resource files'),
'/files': path.join(__dirname, 'path to folder which contains resource files'),
}));
hinos.Server.use(hinosCors.cors());
hinos.Server.use(hinosRoute.route(path.join(__dirname, 'controller')));