Skip to content
Snippets Groups Projects
Commit e62eede6 authored by Moreau Elise's avatar Moreau Elise
Browse files

[cors] package : use express cors to allow access

parent 3e036d57
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
"version": "0.0.0",
"description": "A simple chat",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.17.1",
"express-joi-validation": "^5.0.0",
"express-jwt": "^6.0.0",
......
import express from 'express'
import cors from 'cors'
import * as http from 'http'
import mongoose from "mongoose";
import WebSocket from 'ws'
......@@ -33,12 +34,7 @@ wss.on('connection', function (ws) {
app.use(express.json());
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "*");
res.header("Access-Control-Allow-Methods", "POST, GET, PUT, DELETE");
next();
});
app.use(cors());
app.get('/', function (req, res) {
// res.send('OK')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment