MA
Size: a a a
MA
AK
const mode = NODE_ENV.MODE || 'production';Читал здесь в чате, что лучше сделать файлы с несколькими конфигами(dev/prod) и в зависимости от команды при запуске берется тот или иной конфиг.
const url = mode === 'production' ? '/api/' : 'http://localhost:5000/api/';
AK
(async () => {
const response = await fetch('/api/', {
method: 'POST',
headers: {
'content-type': 'application/json',
},
body: JSON.stringify({ pass: pass }),
});
})();
devServer: {
proxy: {
'/api/': {
target: 'http://localhost:5000',
secure: false,
changeOrigin: true,
},
},
},
AI
const res = await request(app)но как сделать так, чтобы при окончании теста запись откатить ?
.post('/api/users')
.send({
name: 'Bob',
email: 'bob@doe.com',
password: '12345678',
roleId: 2
})
expect(res.statusCode).toEqual(201)
expect(res.body).toHaveProperty('user')
IK
AI
O
ВП
AK
<script src="js/bundle.min.js"> </script>
).router.get('/', getHandler());
В getHandler написано вот что:const fs = require('fs');3). В итоге когда я перехожу на адрес(/) приложения, на реальном сервере, то мой index.html загружается, но пути до внешних css и js становятся неверными и те не загружаются.
module.exports = function getHandler(key, url) {
return async function (ctx, next) {
ctx.status = 200;
ctx.set('Content-Type', 'text/html');
ctx.body = fs.readFileSync('application/static/index.html');
};
};
AK
https://example.com/application/static/index.html
то ошибка 404 not found.AO
AO
h
H
AO
ES
ES
AO
ES