Skip to content

Instantly share code, notes, and snippets.

View tksilicon's full-sized avatar
🏠
Working from home

ThankGod Ukachukwu tksilicon

🏠
Working from home
View GitHub Profile
@tksilicon
tksilicon / CustomerController.java
Created July 27, 2019 03:40
Turning ecommerce challenge, customer controller
/*
* API endpoint to update customers creditcard
*/
@PutMapping(path = "/api/customers/creditCard")
public ResponseEntity<Customer> updateCustomerCreditCard(@Valid @RequestBody CustomerCreditCardForm cust,
UserDetails userDetails) {
try {
Customer existed =
674db37e86ac1ad4f0bf877355902e2904b437ddfcd13009997a772093def0d70f8025bf30f6a36e1d9eae5026e957c89809eb391f387f6bd2344d688f6e8e4c
@tksilicon
tksilicon / app.module.ts
Last active August 29, 2019 22:30
app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { HeaderComponent } from './header/header.component';
import { LoginComponent } from './login/login.component';
import { NotFoundComponent } from './not-found/not-found.component';
import { RouterModule } from '@angular/router';
@tksilicon
tksilicon / app-routing.module.ts
Last active August 29, 2019 22:29
app-routing.module.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { LoginComponent } from './login/login.component';
import { NotFoundComponent } from './not-found/not-found.component';
const routes: Routes = [
{ path: 'login', component: LoginComponent},
{path: '', redirectTo: 'login', pathMatch: 'full'},
{ path: '**', component: NotFoundComponent }];
<app-header></app-header>
<router-outlet></router-outlet>
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss']
})
export class HeaderComponent implements OnInit {
title = 'clientfrontend';
<div style="text-align: center;">
<h1>
Welcome to {{ title }}!
</h1>
<img width="300" alt="My Logo" src="assets/images/tshirtshop.png">
</div>
view raw
export function throwIfAlreadyLoaded(parentModule: any, moduleName: string) {
if (parentModule) {
throw new Error(`${moduleName} has already been loaded. Import Core modules in the AppModule only.`);
}
}
import { Injectable } from '@angular/core';
@Injectable()
export class LoggerService {
log(msg: string) {
console.log(msg);
}
error(msg: string) {
console.error(msg);
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { HeaderComponent } from './header/header.component';
import { LoginComponent } from './login/login.component';
import { NotFoundComponent } from './not-found/not-found.component';
import { RouterModule } from '@angular/router';
import { ReactiveFormsModule } from '@angular/forms';