forked from jsonresume/theme-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
executable file
·37 lines (30 loc) · 878 Bytes
/
server.js
File metadata and controls
executable file
·37 lines (30 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env node
var theme = require('./lib/theme');
var express = require('express');
var bodyParser = require('body-parser');
var cors = require('cors');
var app = express();
var minify = require('express-minify');
var compress = require('compression');
var port = process.env.PORT || 3000;
app.disable('x-powered-by');
app.use(compress());
app.use(minify(
{
cache: __dirname + '/cache'
}));
app.use(function(req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*')
next();
});
app.use(bodyParser.json())
app.use(cors());
app.use("/themes.json", express.static('themes.json'));
app.get('/:theme', theme);
app.post('/:theme', theme);
app.get('/theme/:theme', theme);
app.post('/theme/:theme', theme);
console.log("Starting theme-manager..");
app.listen(port, function() {
console.log('Server is now running at http://localhost:' + port + '/');
});