Commit f9c9a14861ba5d25073af320894e1d149933014e
1 parent
e19811f1
Exists in
master
Adicionado o pacote CORS.
Showing
2 changed files
with
5 additions
and
3 deletions
Show diff stats
Makefile
... | ... | @@ -61,8 +61,8 @@ uninstall: clean |
61 | 61 | @sudo apt-get -y install gcc make build-essential npm |
62 | 62 | @sudo ln -sf "$$HOME" "wikilibras_server" |
63 | 63 | @sudo npm cache clean |
64 | - @sudo npm install -g forever node-gyp | |
65 | - @sudo npm link forever node-gyp | |
64 | + @sudo npm install -g forever node-gyp cors | |
65 | + @sudo npm link forever node-gyp cors | |
66 | 66 | @sudo npm install |
67 | 67 | |
68 | 68 | .update: | ... | ... |
server.js
... | ... | @@ -11,8 +11,10 @@ var path = require('path'); |
11 | 11 | var express = require('express'); |
12 | 12 | var bodyParser = require('body-parser'); |
13 | 13 | var PythonShell = require('python-shell'); |
14 | +var cors = require('cors'); | |
14 | 15 | |
15 | 16 | var app = express(); |
17 | +app.use(cors()) | |
16 | 18 | |
17 | 19 | /* SSL configuration */ |
18 | 20 | var privateKey = fs.readFileSync('sslcert/server.key', 'utf8'); |
... | ... | @@ -78,4 +80,4 @@ app.delete('/api/:hash', function(req, res) { |
78 | 80 | var httpsServer = https.createServer(credentials, app); |
79 | 81 | httpsServer.listen(properties.PORT, properties.HOST, function() { |
80 | 82 | console.log('Server running on ' + properties.HOST + ':' + properties.PORT); |
81 | -}); | |
82 | 83 | \ No newline at end of file |
84 | +}); | ... | ... |