res.send(
Party.findAll().then(party => {
return JSON.stringify(party);
});
);
Party.findAll().then(party => res.json(party));
.post(async (req, res) => {
const party = await Party.findAll();
res.json(party);
})
.post(async (req, res) => {
res.json(await Party.findAll());
})
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:3000' is therefore not allowed access.
The response had HTTP status code 403.
return возращает в скобках html код
render() {
return (
<h1 className="greeting">
Hello, world!
</h1>
);
}
render() {
return React.createElement(
'h1',
{ className: 'greeting' },
'Hello, world!'
);
}
{
$$typeof: Symbol(react.element),
key: null,
props: { className: "greeting", children: "Hello, world!" },
ref: null,
type: "h1",
_owner: null,
_store: { validated: false },
_self: null,
_source: null,
__proto__: Object,
}
React компилятор перед сборкой парсит данные в файлах компонентов...
...Я понимаю что реакт собирает все в ES2015...
или же это нормально для ES6
try {
// что угодно
} catch (err) {
throw err;
}
// что угодно
async method() {
return await _method();
}
method() {
return _method();
}
const foo = () => {
try {
bar();
} catch (e) {
// этот блок не будет вызван никогда, так как ошибка перехватывается в вызове bar()
}
};
const bar = () => {
try {
dangerousCall();
} catch (e) {
// этот блок будет вызван в случае ошибки вызова dangerousCall()
}
}
try {
foo();
} catch (e) {
// этот блок не будет вызван никогда, так как ошибка перехватывается в вызове bar()
}
Правильно ли я понимаю, что я могу убрать try/catch из методов класса Geo? Ведь если я оберну в try/catch вызов geo.method(), то всё работать будет так же.
declare module 'koa-connect-flash' {
const def: any;
export default def;
}
127.0.0.1 my-app
server {
listen 80;
server_name my-app;
location ^~ / {
proxy_pass http://localhost:81/;
}
location ^~ /api/ {
proxy_pass http://localhost:5000/api/;
}
}
http://my-app
и к API в приложении как к http://my-app/api
. npm init
npm install -S JSCPP
ajcom.register('login', async (hCtx, email, pass) => {
const foundUser = await User.findOne({ where: { email } });
if (foundUser && foundUser.password === pass) {
console.log("Авторизация прошла успешно!");
isLoginIn = true;
} else {
console.log("Неверные данные, проверьте ваш email и пароль!");
}
return { authorized: isLoginIn };
});