Archived
commit prepotente
This commit is contained in:
+7
-3
@@ -1,4 +1,4 @@
|
||||
process.env['NODE_ENV'] = 'development';
|
||||
process.env['NODE_ENV'] = 'production';
|
||||
process.env.APIKEY = 'AIzaSyA21Odw9UdfiOJnxvA_eDfOW0OxuUfHKig';
|
||||
const express = require('express');
|
||||
const compression = require('compression')
|
||||
@@ -11,7 +11,6 @@ const app = express(); // app is an instance of express
|
||||
app.use(compression()); // enables gzip compression
|
||||
app.use(bodyParser.urlencoded({ extended: false })) // parse application/x-www-form-urlencoded
|
||||
app.use(bodyParser.json()) // parse application/json
|
||||
app.use(express.static(__dirname + '/build')); // serve static build site
|
||||
|
||||
|
||||
app.get('/a', (req, res) => {
|
||||
@@ -23,7 +22,6 @@ res.send(process.env);
|
||||
// Create database instance and start server
|
||||
// const adapter = new FileAsync(__dirname + '/db.json');
|
||||
low(new FileAsync(__dirname + '/db.json')) // production
|
||||
// low(new FileAsync('/tmp/db.json')) // dev
|
||||
.then(db => {
|
||||
db._.mixin(lodashId);
|
||||
// DATABASE ROUTES
|
||||
@@ -46,6 +44,11 @@ low(new FileAsync(__dirname + '/db.json')) // production
|
||||
|
||||
// ==============
|
||||
|
||||
// GET /videotrack/:id?
|
||||
app.get('/globpop', (req, res) => {
|
||||
req.query.id ? res.send(req.query.id):res.status(400).send('Bad Request');
|
||||
});
|
||||
|
||||
// GET /videotrack/:id?
|
||||
app.get('/videotrack/:id?', (req, res) => {
|
||||
const videos = db.get('videos');
|
||||
@@ -76,5 +79,6 @@ low(new FileAsync(__dirname + '/db.json')) // production
|
||||
return db.defaults({ videos: [] }).write();
|
||||
})
|
||||
.then(() => {
|
||||
app.use(express.static(__dirname + '/build')); // serve static build site
|
||||
app.listen(8000, () => console.log('listen on 8000')); // bind to port 8000 as required from specs
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user