make url more dynamic, to allow for nginx proxy pass on /files
This commit is contained in:
parent
e8fabb0a78
commit
e4f20290fe
3 changed files with 3 additions and 3 deletions
2
index.js
2
index.js
|
@ -139,7 +139,7 @@ app.post('/api/upload', [ cors(corsOptions) ], (req, res) => {
|
||||||
} else if(err.code === 'ENOENT') {
|
} else if(err.code === 'ENOENT') {
|
||||||
file.mv(filepath, (err) => {
|
file.mv(filepath, (err) => {
|
||||||
if (err) return res.status(500).render('uploadfailed', { message: 'something went wrong while uploading the file.' });
|
if (err) return res.status(500).render('uploadfailed', { message: 'something went wrong while uploading the file.' });
|
||||||
res.render('uploaded', { file: { name: chosenFileName } });
|
res.render('uploaded', { file: { name: chosenFileName }, config: { url: config.url } });
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return res.status(500).render('uploadfailed', { message: 'something went wrong.' });;
|
return res.status(500).render('uploadfailed', { message: 'something went wrong.' });;
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
<h1>the file was uploaded</h1>
|
<h1>the file was uploaded</h1>
|
||||||
<p>i think</p>
|
<p>i think</p>
|
||||||
<br>
|
<br>
|
||||||
<a href="/file/<%= file.name %>">go to file</a>
|
<a href="<%= config.url %>/file/<%= file.name %>">go to file</a>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -10,6 +10,6 @@
|
||||||
<p>i think</p>
|
<p>i think</p>
|
||||||
<p><%= message %></p>
|
<p><%= message %></p>
|
||||||
<br>
|
<br>
|
||||||
<a href="/">go back</a>
|
<a href="/">home</a>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in a new issue