Skip to content

Instantly share code, notes, and snippets.

View fexx's full-sized avatar
🎯
Focusing

Fernando Evangelista fexx

🎯
Focusing
View GitHub Profile
@fexx
fexx / car.service.ts
Last active July 31, 2020 21:43
Arquivo car.service.ts (Consumindo API REST com HttpClient no Angular 8)
import { Injectable } from '@angular/core';
import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
import { retry, catchError } from 'rxjs/operators';
import { Car } from '../models/car';
@Injectable({
providedIn: 'root'
})
export class CarService {
function FindProxyForURL(url, host) {
url = url.toLowerCase();
host = host.toLowerCase();
if (isPlainHostName(host)) {
return "DIRECT";
}
if ((host == "hml.mol.mapfre.com.br") ||
(host == "ftp.mapfre.com.br") ||
@fexx
fexx / pom.xml
Last active November 2, 2019 15:30
pom.xml - Criando imagem docker com maven
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
@fexx
fexx / settings.xml
Last active November 2, 2019 04:14
settings.xml - Criando e enviando imagem Docker com Java e Maven
<server>
<id>docker.io</id>
<username>{docker_id}</username>
<password>{senha_docker_hub}</password>
<configuration>
<email>{email}</email>
</configuration>
</server>
@fexx
fexx / app.component.ts
Last active October 21, 2019 00:34
app.component.ts (Consumindo API REST com HttpClient no Angular 8)
import { Component, OnInit } from '@angular/core';
import { CarService } from './services/car.service';
import { Car } from './models/car';
import { NgForm } from '@angular/forms';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
@fexx
fexx / car.ts
Last active October 21, 2019 00:31
car.ts (Consumindo API REST com HttpClient no Angular 8)
export interface Car {
id: number;
model: string;
color: string;
price: number;
}
@fexx
fexx / app.component.css
Created October 19, 2019 21:46
app.component.css (Consumindo API REST com HttpClient no Angular 8)
.container {
margin-top: 30px;
}
.add-car {
margin-bottom: 30px;
}
.list-car {
margin-bottom: 50px;
@fexx
fexx / app.component.html
Created October 19, 2019 21:45
app.component.html (Consumindo API REST com HttpClient no Angular 8)
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item active" aria-current="page">Gerenciamento de carros</li>
</ol>
</nav>
<div class="container">
<div class="card list-car">
<h5 class="card-header">Lista de carros</h5>
<div class="card-body">
<table class="table">
@fexx
fexx / index.html
Created October 19, 2019 21:43
index.html (Consumindo API REST com HttpClient no Angular 8)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>AngularHttp</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
@fexx
fexx / car.services.ts
Created October 19, 2019 21:11
Métodos http Consumindo API REST com HttpClient no Angular 8)
this.httpClient.get<Car[]>(this.url)
this.httpClient.post<Car>(this.url, JSON.stringify(car), this.httpOptions)
this.httpClient.put<Car>(this.url + '/' + car.id, JSON.stringify(car), this.httpOptions)
this.httpClient.delete<Car>(this.url + '/' + car.id, this.httpOptions)