const express = require('express');
const path = require('path');

const app = express();
const PORT = process.env.PORT || 5000;

// Priority serve any static files.
app.use(express.static(path.resolve(__dirname, '../react-ui/build')));

// Answer API requests.
app.get('/api', function (req, res) {
  res.set('Content-Type', 'application/json');
  res.send('{"message":"Hello from the custom server!"}');
});

// All remaining requests return the React app, so it can handle routing.
app.get('*', function(request, response) {
  response.sendFile(path.resolve(__dirname, '../react-ui/build', 'index.html'));
});

app.listen(PORT, function () {
  console.log(`Listening on port ${PORT}`);
});

@@ -1,12 +1,40 @@
+require('dotenv').config()%0A%0A
 const expres
@@ -88,16 +88,76 @@
 ath');%0A%0A
+const getAccessToken = require('./utilities/access_token')%0A%0A
 const ap
@@ -247,16 +247,16 @@
  files.%0A
-
 app.use(
@@ -315,24 +315,184 @@
 build')));%0A%0A
+%0AgetAccessToken(process.env.CLIENT_ID,process.env.CLIENT_SECRET)%0A  .then((result) =%3E console.log(result.access_token))%0A  .catch(error =%3E console.error(error))%0A%0A
 // Answer AP

test getAccessToken function