const http = require("http");
const express = require('express');
const app = express();
const http_server = http.createServer(app);
const mysql = require("mysql");
const connection = mysql.createConnection({
host: "localhost",
user: "root",
database: "bs",
password: ""
});
connection.connect(function (err) {
if (err) {
return console.error("Ошибка: " + err.message);
} else {
//res.send('Подключение к серверу MySQL успешно установлено');
}
});
app.get(/.*BRAND$/, function (req, res) {
let reg = /%20/gi;
let brand = req.url.slice(1).slice(0, -5).replace(reg, ' ');
let query;
if(brand == 'All'){
query = `SELECT * FROM bs`;
} else{
query = `SELECT * FROM bs WHERE brand = '${brand}'`;
}
connection.query(query, (err, result, field) =>{
res.send(result);
})
});
http_server.listen(4000, () => {
console.log('Server started on port 4000');
});
<div class="input_box reg_item" *ngIf="!form_type">
<input
type="text"
name="first_name"
placeholder="Имя"
formControlName="first_name"
/>
<div class="validation" *ngIf="validate('first_name').length">
<fa-icon [icon]="icons.faCircleExclamation" class="error"></fa-icon>
<div class="description">
<div class="item" *ngFor="let item of validate('first_name')">
{{ item }}
</div>
<div class="rect"></div>
</div>
</div>
</div>
public validate(name: string): any[] {
const field = this.form_field(name);
if(field && field.invalid && (field.dirty || field.touched) && field.errors) {
const arr = Object.keys(field.errors).map(error => {
switch (error) {
case 'required': return 'Заполните поле.';
case 'minlength': return 'Минимальное количество символов ' + field.errors?.[error]['requiredLength'];
case 'maxlength': return 'Максимальное количество символов ' + field.errors?.[error]['requiredLength'];
case 'email': return 'Некорректный адрес';
default: return null;
}
});
return arr.every(el => el) && arr || [];
}
return [];
}
Вы сейчас в таком положении, что Вам нужно продать себя. Причём хоть за сколько нибудь.