From 680715c2626fd5b7601c50f655b0243a054e8375 Mon Sep 17 00:00:00 2001 From: Keksike Date: Sun, 2 Jul 2017 19:35:56 +0300 Subject: [PATCH] remove newrelic from use in devenv --- README.md | 8 ++------ config.template.json | 18 ------------------ index.js | 7 +++++-- 3 files changed, 7 insertions(+), 26 deletions(-) delete mode 100644 config.template.json diff --git a/README.md b/README.md index 06b0925..07d8098 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,6 @@ $ cd koodiklinikka.fi-api $ npm install ``` -* Create `config.json` file. See [config.template.json](https://github.com/koodiklinikka/koodiklinikka.fi-api/blob/master/config.template.json) for possible options. -The config file consists of environment specific blocks. Environment variable `NODE_ENV` determines which block is used. If the environment variable is not present, the `development` block will be selected. -`all` block is always used and the block selected is merged into it so that it overwrites the values defined in it. +* ``` $ npm start ``` -* ``` -$ npm start -``` \ No newline at end of file +Now app will be running on `localhost:9000`. \ No newline at end of file diff --git a/config.template.json b/config.template.json deleted file mode 100644 index 2632874..0000000 --- a/config.template.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "all": { - "slack": { - "token": "", - "privateChannel": "", - "publicChannel": "" - }, - "github": { - "token": "" - }, - "twitter": { - "consumerKey": "", - "consumerSecret": "", - "token": "", - "tokenSecret": "" - } - } -} diff --git a/index.js b/index.js index f7281c6..1eeaa59 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,3 @@ -require('newrelic'); 'use strict'; var express = require('express'); @@ -7,9 +6,13 @@ var cors = require('cors'); var bodyParser = require('body-parser'); var app = express(); +if(app.get('env') != 'development') { + require('newrelic'); +} + app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: true})); -app.use(cors()); +app.use(cors({credentials: true, origin: true})); morgan.token('body', function(req) { return JSON.stringify(req.body);