back_end_docker #9

Merged
lucien merged 23 commits from back_end_docker into back_end 2024-12-06 03:36:58 +00:00
2 changed files with 19 additions and 4 deletions
Showing only changes of commit bf73ed1698 - Show all commits

View file

@ -9,7 +9,7 @@ export default function ArticlesSection() {
const [error, setError] = useState<string | null>(null);
useEffect(() => {
fetch('/api/article')
fetch('/api/articles')
.then(response => response.json())
.then((data: ArticlePreview[]) => setArticlePreviews(data))
.catch(_ => setError('Failed to fetch articles'))

View file

@ -7,10 +7,25 @@ export default defineConfig({
server: {
proxy: {
'/api': {
target: 'http://localhost:2486',
target: 'http://127.0.0.1:2486',
changeOrigin: true,
rewrite: path => path.replace(/^\/api/, '')
}
secure: false,
ws: true,
/*
configure: (proxy, _options) => {
proxy.on('error', (err, _req, _res) => {
console.log('proxy error', err);
});
proxy.on('proxyReq', (proxyReq, req, _res) => {
console.log('Sending Request to the Target:', req.method, req.url);
});
proxy.on('proxyRes', (proxyRes, req, _res) => {
console.log('Received Response from the Target:', proxyRes.statusCode, req.url);
});
},
*/
//rewrite: path => path.replace(/^\/api/, '')
}
}
},
})