Skip to content

Commit 89d7f54

Browse files
committed
Add support for setting up express server
This is done through the mu helper, which is easy to import.
1 parent c0ef0cc commit 89d7f54

File tree

5 files changed

+27
-3
lines changed

5 files changed

+27
-3
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ ENV MU_SPARQL_ENDPOINT 'http://database:8890/sparql'
66
ENV MU_APPLICATION_GRAPH 'http://mu.semte.ch/application'
77

88
WORKDIR /usr/src/app
9-
109
COPY . /usr/src/app
10+
1111
RUN ln -s /app/app.js /usr/src/app/
1212
RUN npm install
1313

boot.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#! /bin/sh
22
./node_modules/supervisor/lib/cli-wrapper.js \
33
-w /usr/src/app,/app \
4-
-i /usr/src/app/node_modules,/app/node_modules \
4+
-i /usr/src/app/node_modules,/usr/src/app/helpers,/app/node_modules \
55
-e .js \
66
-k --ignore-symlinks \
77
-x sh start.sh

helpers/mu/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import express from 'express';
2+
3+
var app = express();
4+
5+
app.listen( 80, function() {
6+
console.log('Starting server on port 80');
7+
});
8+
9+
export default app;

helpers/mu/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "mu",
3+
"version": "0.0.1",
4+
"description": "Helpers for javascript mu services",
5+
"author": "Aad Versteden <[email protected]>",
6+
"license": "MIT",
7+
"homepage": "https://mu.semte.ch",
8+
"devDependencies": {
9+
"babel-cli": "^6.18.0",
10+
"babel-preset-es2015": "^6.18.0",
11+
"babel-preset-es2016": "^6.16.0",
12+
"babel-preset-es2017": "^6.16.0",
13+
"supervisor": "^0.12.0"
14+
}
15+
}

start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ ps aux | grep babel-node | awk '{print $1}' | xargs kill -9
77
npm install
88

99
## Run using babel
10-
NODE_PATH=`pwd`/node_modules:$NODE_PATH ./node_modules/babel-cli/bin/babel-node.js app.js --presets es2015,es2016,es2017
10+
NODE_PATH=`pwd`/node_modules:`pwd`/helpers:$NODE_PATH ./node_modules/babel-cli/bin/babel-node.js app.js --presets es2015,es2016,es2017

0 commit comments

Comments
 (0)