forked from branden-thompson/atomic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
23 lines (17 loc) · 688 Bytes
/
server.js
File metadata and controls
23 lines (17 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*global __dirname:true */
// server.js file
var path = require('path');
var express = require('express');
var exec = require('child_process').exec;
var app = express();
exec('git describe HEAD', function(err, version) {
var atomicVersion = version.replace(/[\s]/g, '');
// examples go to the dist's starterpack
app.get('/examples/scripts/atomic/*', function(req, res) {
return res.redirect('/starter_pack/'+req.params[0]);
});
app.use(express.static(path.normalize(__dirname)));
// this makes atomic.js and atomic.min.js local from /
app.use(express.static(path.normalize(path.join(__dirname, './', 'dist', 'atomic-' + atomicVersion))));
});
module.exports = app;