Skip to content
Snippets Groups Projects
Commit 7d2dd163 authored by Lucendio's avatar Lucendio
Browse files

Introduce /env endpoint & elaborate one the purpose of the Makefile

parent 4738f31a
No related branches found
No related tags found
No related merge requests found
......@@ -8,16 +8,18 @@ This repository contains the [application](./app/README.md) that should be used
### Getting started
For more information regarding the app, please have a look into its [README](./app/README.md).
For more information regarding the app, please take a look into its [README](./app/README.md).
The `Makefile` is the main entry point for this repository. It's meant to be used for documentation purposes and local
development/invocation only. The following commands are available:
The `Makefile` is the main entry point for this repository. It's meant to locally play and mess around with the
application to figure out how it works and to tear it apart if necessary. Additionally, it should document all
invocations relevant to help you adapt this application as *workload* for the exercise implementation.
*NOTE:*
**_Please note, that this `Makefile` is solely meant to showcase how to interact with the application and the code base.
It is not recommended to invoke `make` targets from the CI/CD, but rather use automation-specific interfaces
(e.g. `Jenkinsfile`, `.travis.yml`, etc.), which would then invoke commands shown under some make target or in on eof the
`package.json` files._**
The `Makefile` is solely meant to showcase how to interact with the application and the code base, it is not recommended
to invoke make targets from the CI/CD, but rather use automation-specific interfaces (e.g. `Jenkinsfile`, `.travis.yml`,
etc.), which would then invoke logic also shown under some make target.
The following commands are available:
#### `make install-stack`
......
......@@ -7,6 +7,7 @@ const dbClientInstance_ = require('./db/mongo.js');
const todoRoutes = require('./routes/todo');
const userRoutes = require('./routes/user');
const errorRoutes = require('./routes/error');
const envRoute = require('./routes/env.js');
let cookieParser = require('cookie-parser');
const app = express();
......@@ -34,6 +35,10 @@ app.use(helmet.contentSecurityPolicy({
app.use(todoRoutes);
app.use(userRoutes);
app.use('/', express.static(path.resolve(__dirname, `./public`)));
// IMPORTANT: Educational purpose only! Possibly exposes sensitive data.
app.use(envRoute);
// NOTE: must be last one, because is uses a wildcard (!) that behaves aa
// fallback and catches everything else
app.use(errorRoutes);
......
const express = require('express');
const routes = express.Router();
routes.get('/env', (req, res) => {
res.send( process.env );
});
module.exports = routes;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment