-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from UniversityOfHelsinkiCS/trunk
Initial
- Loading branch information
Showing
9 changed files
with
3,283 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
language: node_js | ||
node_js: | ||
- '8' | ||
|
||
cache: | ||
directories: | ||
- node_modules | ||
|
||
addons: | ||
postgresql: "9.6" | ||
apt: | ||
packages: | ||
- postgresql-9.6 | ||
- postgresql-client-9.6 | ||
|
||
services: | ||
- redis-server | ||
- docker | ||
- postgresql | ||
|
||
dist: trusty | ||
|
||
env: | ||
global: | ||
- NODE_ENV=test | ||
- DB_URL=postgres://postgres@localhost/ooditest | ||
|
||
before_script: | ||
- psql --version | ||
- psql -c 'create database ooditest' -U postgres | ||
- psql -l | ||
|
||
script: | ||
- if [[ $TRAVIS_BRANCH =~ (^master) ]]; then docker build -t toska/oodikone2-analytics:staging .; fi | ||
- if [[ $TRAVIS_BRANCH =~ (^master) ]]; then docker login -u $DOCKER_USER -p $DOCKER_PASS; fi | ||
- if [[ $TRAVIS_BRANCH =~ (^master) ]]; then docker push toska/oodikone2-analytics:staging; fi | ||
- if [[ $TRAVIS_TAG =~ ([0-1].+) ]]; then docker build -t toska/oodikone2-analytics:latest .; fi | ||
- if [[ $TRAVIS_TAG =~ ([0-1].+) ]]; then docker login -u $DOCKER_USER -p $DOCKER_PASS; fi | ||
- if [[ $TRAVIS_TAG =~ ([0-1].+) ]]; then docker push toska/oodikone2-analytics:latest; fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM node:8.11.3 | ||
|
||
RUN mkdir -p /usr/src/app | ||
COPY . /usr/src/app | ||
WORKDIR /usr/src/app | ||
|
||
RUN npm install | ||
EXPOSE 4568 | ||
|
||
CMD ["npm", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
# oodikone2-analytics | ||
# oodikone2-analytics | ||
|
||
[![Build Status](https://travis-ci.org/UniversityOfHelsinkiCS/oodikone2-analytics.svg?branch=master)](https://travis-ci.org/UniversityOfHelsinkiCS/oodikone2-analytics) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const express = require('express') | ||
|
||
const app = express() | ||
const port = 4568 | ||
const bodyParser = require('body-parser') | ||
|
||
app.use(bodyParser.json()) | ||
|
||
app.get('/ping', (req, res) => res.json({ message: 'pong '})) | ||
|
||
let fetching = false | ||
let data = null | ||
app.get('/data', (req, res) => { | ||
if (fetching) { | ||
return res.json(data) | ||
} | ||
if (!data) { | ||
data = { data: "datahere" } // recalculate? | ||
} | ||
return res.json(data) | ||
}) | ||
|
||
app.listen(port, () => console.log(`Analytics listening on port ${port}!`)) |
Oops, something went wrong.