This file contains 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
GET https://api.ipify.org/ | |
### GET Image construction | |
GET https://upload.wikimedia.org/wikipedia/commons/2/20/UnderCon_icon.svg | |
### GET Tim Berner Lee | |
GET https://www.w3.org/History/19921103-hypertext/hypertext/WWW/TheProject.html | |
### GET Heroes | |
GET https://http-practice.herokuapp.com/status | |
### GET application statis in JSON format | |
GET https://http-practice.herokuapp.com/status | |
Accept: application/json |
This file contains 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 express = require('express'); | |
const app = express(); | |
const port = 3000; | |
app.get("/api/movies", (req, res) => { | |
res.send("Récupère tout les films"); | |
}); | |
app.get("/api/movies/:id", (req, res) => { | |
res.json({ id: req.params.id }); |
This file contains 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 express = require('express'); | |
const app = express(); | |
const port = 3000; | |
const connection = require('./conf'); | |
app.get('/api/movie', (req, res) => { | |
// connection to the database, and selection of employees | |
connection.query('SELECT * from movie', (err, results) => { | |
console.log(err) |
This file contains 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 express = require('express'); | |
const app = express(); | |
const port = 3000; | |
const connection = require('./conf'); | |
const bodyParser = require('body-parser'); | |
// Support JSON-encoded bodies | |
app.use(bodyParser.json()); | |
// Support URL-encoded bodies | |
app.use(bodyParser.urlencoded({ | |
extended: true |
This file contains 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 express = require('express'); | |
const app = express(); | |
const port = 3000; | |
const connection = require('./conf'); | |
const bodyParser = require('body-parser'); | |
// Support JSON-encoded bodies | |
app.use(bodyParser.json()); | |
// Support URL-encoded bodies | |
app.use(bodyParser.urlencoded({ | |
extended: true |
This file contains 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
<form [formGroup]= "userForm"(ngSubmit)="onSubmit()"> | |
<div formGroupName="address"> | |
<div> | |
<label> | |
Street: | |
<input type="text" formControlName="street"> | |
</label> | |
</div> | |
<div> |
This file contains 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 { AbstractControl, ValidationErrors } from '@angular/forms'; | |
export function emailValidator(control: AbstractControl): ValidationErrors | null { | |
// One uppercase at least | |
const emailRegex = RegExp('^[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\\.[a-z]{2,3}$'); | |
const valid = emailRegex.test(control.value); | |
const errors = { | |
email: { | |
rules: 'should be a valid email adress' |
OlderNewer