This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"/api": { | |
"target": "http://localhost:3000/api", | |
"secure": false | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import express from 'express'; | |
import cookieParser from 'cookie-parser'; | |
import csurf from 'csurf'; | |
const app = express(); | |
const csrfProtection = csurf({ | |
cookie: true, | |
ignoreMethods: ['GET', 'HEAD', 'OPTIONS'], | |
}); | |
app.use(cookieParser()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"start": "ng serve --proxy-config proxy.conf.json", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.scss'] | |
}) | |
export class AppComponent { | |
title = 'App'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hiGreeterStudent = new Student(); | |
const helloGreeterStudent = new HelloGreeter(new Student()); | |
const goodMorningGreeterTeacher = new GoodMorningGreeter(new Teacher()); | |
hiGreeterStudent.greet(); //"Hi!" | |
helloGreeterStudent.greet(); //"Hello!" | |
goodMorningGreeterTeacher.greet(); //"Good morning!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Person { | |
greet(): string; | |
} | |
class Student implements Person { | |
public greet(): string { | |
return 'Hi!'; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Greeter implements Person { | |
protected person: Person; | |
constructor(person: Person) { | |
this.person = person; | |
} | |
public greet(): string { | |
return this.person.greet(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setTimeout(() => { | |
console.log('Hello timeout!'); | |
}, 1000); //will print "Hello timeout!" once, after 1 second | |
setInterval(() => { | |
console.log('Hello interval!'); | |
}, 1000) //will print "Hello interval!" every 1 second |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('Start'); | |
setTimeout(() => { | |
console.log('Hello timeout!'); | |
}, 0); | |
console.log('End'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setTimeout(function run() { | |
console.log('Hello!'); | |
setTimeout(run, 1000); | |
}, 1000); |
OlderNewer