Skip to content

Commit 2d3309c

Browse files
committed
Add frontend backoffice skeleton
1 parent 3e9368a commit 2d3309c

18 files changed

Lines changed: 165 additions & 37 deletions

package-lock.json

Lines changed: 47 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
},
99
"scripts": {
1010
"dev": "NODE_ENV=dev ts-node-dev --ignore-watch node_modules --inspect=0.0.0.0:9267 ./src/apps/mooc_backend/server.ts",
11+
"dev:backoffice:frontend": "NODE_ENV=dev ts-node-dev --ignore-watch node_modules --inspect=0.0.0.0:9267 ./src/apps/backoffice/frontend/server.ts",
1112
"test": "npm run test:unit && npm run test:features",
1213
"test:unit": "NODE_ENV=test jest",
1314
"test:features": "NODE_ENV=test cucumber-js -p default",
1415
"start": "NODE_ENV=production node dist/src/apps/mooc_backend/server",
16+
"start:backoffice:frontend": "NODE_ENV=production node dist/src/apps/backoffice/frontend/server",
1517
"build": "npm run build:clean && npm run build:tsc && npm run build:di",
1618
"build:tsc": "tsc -p tsconfig.prod.json",
1719
"build:di": "copy 'src/**/*.yaml' dist/src",
@@ -34,6 +36,7 @@
3436
"compression": "^1.7.4",
3537
"convict": "^5.1.0",
3638
"copy": "^0.3.2",
39+
"ejs": "^3.1.3",
3740
"errorhandler": "^1.5.1",
3841
"express": "^4.17.1",
3942
"glob": "^7.1.6",
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import bodyParser from 'body-parser';
2+
import express from 'express';
3+
import helmet from 'helmet';
4+
import compress from 'compression';
5+
import { registerRoutes } from './routes';
6+
import path from 'path';
7+
8+
const app: express.Express = express();
9+
10+
app.set('port', process.env.PORT || 8032);
11+
app.set('view engine', 'ejs');
12+
app.set('views', path.join(__dirname, '/views'));
13+
14+
app.use(bodyParser.json());
15+
app.use(bodyParser.urlencoded({ extended: true }));
16+
app.use(helmet.xssFilter());
17+
app.use(helmet.noSniff());
18+
app.use(helmet.hidePoweredBy());
19+
app.use(helmet.frameguard({ action: 'deny' }));
20+
app.use(compress());
21+
22+
registerRoutes(app);
23+
24+
export default app;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import convict from 'convict';
2+
3+
const convictConfig = convict({
4+
env: {
5+
doc: 'The application environment.',
6+
format: ['production', 'development', 'staging', 'test'],
7+
default: 'default',
8+
env: 'NODE_ENV'
9+
}
10+
});
11+
12+
convictConfig.loadFile([__dirname + '/default.json', __dirname + '/' + convictConfig.get('env') + '.json']);
13+
14+
export default convictConfig;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
services:
2+
Contexts.shared.Logger:
3+
class: ../../../../../Contexts/Shared/infrastructure/WinstonLogger
4+
arguments: []
5+
6+
Apps.Backoffice.Frontend.controllers.HomeGetController:
7+
class: ../../controllers/HomeGetController
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
imports:
2+
- { resource: ./application.yaml }
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
imports:
2+
- { resource: ./application.yaml }
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
imports:
2+
- { resource: ./application.yaml }
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
imports:
2+
- { resource: ./application.yaml }

0 commit comments

Comments
 (0)