2
.gitignore
vendored
2
.gitignore
vendored
@@ -9,6 +9,6 @@ npm-debug.log
|
|||||||
webpage/js/env_variables.js
|
webpage/js/env_variables.js
|
||||||
client/dist
|
client/dist
|
||||||
src/webserver/access.log
|
src/webserver/access.log
|
||||||
seasoned_api/conf/development.json
|
./seasoned_api/conf/
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
*/yarn.lock
|
*/yarn.lock
|
||||||
|
|||||||
24
seasoned_api/conf/development.json
Normal file
24
seasoned_api/conf/development.json
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"database": {
|
||||||
|
"host": "../shows.db"
|
||||||
|
},
|
||||||
|
"webserver": {
|
||||||
|
"port": 31459
|
||||||
|
},
|
||||||
|
"tmdb": {
|
||||||
|
"apiKey": ""
|
||||||
|
},
|
||||||
|
"raven": {
|
||||||
|
"DSN": ""
|
||||||
|
},
|
||||||
|
"mail": {
|
||||||
|
"host": "",
|
||||||
|
"user": "",
|
||||||
|
"password": "",
|
||||||
|
"user_pi": "",
|
||||||
|
"password_pi": ""
|
||||||
|
},
|
||||||
|
"authentication": {
|
||||||
|
"secret": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
1
seasoned_api/conf/output.log
Normal file
1
seasoned_api/conf/output.log
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -3,8 +3,10 @@ const Raven = require('raven');
|
|||||||
const bodyParser = require('body-parser');
|
const bodyParser = require('body-parser');
|
||||||
const tokenToUser = require('./middleware/tokenToUser');
|
const tokenToUser = require('./middleware/tokenToUser');
|
||||||
const mustBeAuthenticated = require('./middleware/mustBeAuthenticated');
|
const mustBeAuthenticated = require('./middleware/mustBeAuthenticated');
|
||||||
|
const configuration = require('src/config/configuration').getInstance();
|
||||||
|
|
||||||
Raven.config('__DSN__').install();
|
// TODO: Have our raven router check if there is a value, if not don't enable raven.
|
||||||
|
Raven.config(configuration.get('raven', 'DSN')).install();
|
||||||
const app = express(); // define our app using express
|
const app = express(); // define our app using express
|
||||||
app.use(Raven.requestHandler());
|
app.use(Raven.requestHandler());
|
||||||
// this will let us get the data from a POST
|
// this will let us get the data from a POST
|
||||||
@@ -20,13 +22,16 @@ const port = 31459; // set our port
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const allowedOrigins = ['https://kevinmidboe.com', 'http://localhost:8080'];
|
const allowedOrigins = ['https://kevinmidboe.com', 'http://localhost:8080'];
|
||||||
|
|
||||||
|
// TODO: All JSON handling in a single router
|
||||||
// router.use(bodyParser.json());
|
// router.use(bodyParser.json());
|
||||||
app.use(bodyParser.urlencoded({ extended: true }));
|
app.use(bodyParser.urlencoded({ extended: true }));
|
||||||
|
|
||||||
|
|
||||||
|
// This is probably a correct middleware/router setup
|
||||||
/* Decode the Authorization header if provided */
|
/* Decode the Authorization header if provided */
|
||||||
router.use(tokenToUser);
|
router.use(tokenToUser);
|
||||||
|
|
||||||
|
// TODO: Should have a separate middleware/router for handling headers.
|
||||||
router.use((req, res, next) => {
|
router.use((req, res, next) => {
|
||||||
// TODO add logging of all incoming
|
// TODO add logging of all incoming
|
||||||
console.log('Request: ', req.originalUrl);
|
console.log('Request: ', req.originalUrl);
|
||||||
|
|||||||
Reference in New Issue
Block a user