Add node_env-var for serverstart; Add Signature preview and link copy

pull/1/head
Florian Hartwich 2017-05-19 00:45:43 +02:00
parent 156604105e
commit e586df6aa4
6 changed files with 23 additions and 7 deletions

View File

@ -35,6 +35,8 @@ mongoose.Promise = global.Promise;
// app creation
const app = express();
// Middlewares *************************************************
// setup CORS-middleware
const corsOptions = {
methods: ['GET'],
@ -42,17 +44,13 @@ const corsOptions = {
};
app.use(cors(corsOptions));
// Middlewares *************************************************
app.use(favicon(path.join(__dirname + '/..', 'public', 'favicon.ico')));
app.use(express.static(path.join(__dirname + '/..', 'public')));
app.use(bodyParser.json());
// API request checks for API-version and JSON etc.
app.use(restAPIchecks);
// Routes ******************************************************
app.use(urls.signatures, signatureRouter);
@ -62,7 +60,7 @@ if (!process.env.NODE_ENV) {
app.use(requestLogger('dev'));
} else if (process.env.NODE_ENV !== config.test.env) {
// production logging, apache style
app.use(requestLogger(':date :remote-addr :method :url :status :response-time ms'));
app.use(requestLogger(':date[iso] :remote-addr :method :url :status :response-time ms'));
}
app.use(urls.auth, authenticateRouter);

View File

@ -4,7 +4,7 @@
"license": "MIT",
"private": true,
"scripts": {
"start": "npm run deploy-static-prod && node ./api/server.js",
"start": "npm run deploy-static-prod && NODE_ENV=production node ./api/server.js",
"dev": "npm run deploy-static && nodemon ./api/server.js",
"deploy-static": "cd ./static && ng build && ln -s ../api/resource/ ../public/resource",
"deploy-static-prod": "cd ./static && ng build --env=prod && ln -s ../api/resource/ ../public/resource",

View File

@ -23,6 +23,7 @@
"jquery": "^3.1.0",
"jquery-ui": "^1.12.0",
"jquery-ui-bundle": "^1.11.4",
"ngx-clipboard": "^8.0.2",
"rxjs": "^5.2.0",
"socket.io-client": "^1.4.8",
"ts-helpers": "^1.1.1",

View File

@ -26,9 +26,10 @@ import {LoginGuard} from "./login/login.guard";
import {AwardingService} from "./services/awarding-service/awarding.service";
import {HttpClient} from "./services/http-client";
import {ArmyService} from "./services/army-service/army.service";
import { ClipboardModule } from 'ngx-clipboard';
@NgModule({
imports: [BrowserModule, FormsModule, ReactiveFormsModule, appRouting, HttpModule],
imports: [BrowserModule, FormsModule, ReactiveFormsModule, appRouting, HttpModule, ClipboardModule],
providers: [
HttpClient,
LoginService,

View File

@ -9,6 +9,17 @@
<div class="overview">
<div>
<img style="padding-left: 13%;" src="/signatures/{{user.username}}">
</div>
<div class="input-group" style="width: 662px; margin-left: 13%;">
<input type="text" class="form-control" [(ngModel)]="signatureUrl">
<span class="input-group-btn">
<button class="btn btn-default" [class.btn-success]="isCopied" type="button"
ngxClipboard [cbContent]="signatureUrl" (cbOnSuccess)="isCopied = true">kopieren</button>
</span>
</div>
<div class="pull-left" style="margin-top:20px;">
<div class="table-container" style="width: 75%; min-width: 500px">
<table class="table table-hover">

View File

@ -16,6 +16,10 @@ export class ArmyMemberComponent {
user: User = {};
signatureUrl;
isCopied = false;
constructor(private router: Router,
private route: ActivatedRoute,
private userService: UserService) {
@ -28,6 +32,7 @@ export class ArmyMemberComponent {
.flatMap(id => this.userService.getUser(id))
.subscribe(user => {
this.user = user;
this.signatureUrl = window.location.origin + '/resource/signature/' + user._id + '.png';
});
};