Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mirador File Uploader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IIIF
Mirador
Mirador File Uploader
Commits
cce66d1e
Commit
cce66d1e
authored
1 year ago
by
Anthony
Browse files
Options
Downloads
Patches
Plain Diff
Update server to avoid cors
parent
ee460c0a
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.env
+1
-1
1 addition, 1 deletion
.env
app/package.json
+1
-0
1 addition, 0 deletions
app/package.json
app/server.js
+6
-1
6 additions, 1 deletion
app/server.js
with
8 additions
and
2 deletions
.env
+
1
−
1
View file @
cce66d1e
COMPOSE_FILE=docker-compose.yml
:traefik.yml
COMPOSE_FILE=docker-compose.yml
# prod container restart policy
# prod container restart policy
RESTART=always
RESTART=always
...
...
This diff is collapsed.
Click to expand it.
app/package.json
+
1
−
0
View file @
cce66d1e
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
"author"
:
""
,
"author"
:
""
,
"license"
:
"ISC"
,
"license"
:
"ISC"
,
"dependencies"
:
{
"dependencies"
:
{
"cors"
:
"^2.8.5"
,
"express"
:
"^4.18.2"
,
"express"
:
"^4.18.2"
,
"multer"
:
"^1.4.5-lts.1"
"multer"
:
"^1.4.5-lts.1"
}
}
...
...
This diff is collapsed.
Click to expand it.
app/server.js
+
6
−
1
View file @
cce66d1e
const
express
=
require
(
'
express
'
);
const
express
=
require
(
'
express
'
);
const
multer
=
require
(
'
multer
'
);
const
multer
=
require
(
'
multer
'
);
const
cors
=
require
(
'
cors
'
)
const
app
=
express
();
const
app
=
express
();
const
port
=
3000
;
const
port
=
3000
;
app
.
use
(
'
/static
'
,
express
.
static
(
'
upload
'
));
app
.
use
(
'
/static
'
,
express
.
static
(
'
upload
'
));
app
.
use
(
cors
());
const
storage
=
multer
.
diskStorage
({
const
storage
=
multer
.
diskStorage
({
destination
:
function
(
req
,
file
,
cb
)
{
destination
:
function
(
req
,
file
,
cb
)
{
...
@@ -16,10 +18,13 @@ const storage = multer.diskStorage({
...
@@ -16,10 +18,13 @@ const storage = multer.diskStorage({
const
upload
=
multer
({
storage
:
storage
});
const
upload
=
multer
({
storage
:
storage
});
app
.
post
(
'
/upload
'
,
upload
.
single
(
'
file
'
),
(
req
,
res
)
=>
{
app
.
post
(
'
/upload
'
,
upload
.
single
(
'
file
'
),
(
req
,
res
)
=>
{
console
.
log
(
'
File uploaded:
'
,
req
.
file
);
console
.
log
(
'
Param filename:
'
,
req
);
res
.
setHeader
(
'
Access-Control-Allow-Origin
'
,
'
*
'
);
res
.
send
({
res
.
send
({
message
:
'
File uploaded successfully
'
,
message
:
'
File uploaded successfully
'
,
file
:
req
.
file
file
:
req
.
file
});
}
,
);
});
});
app
.
listen
(
port
,
()
=>
{
app
.
listen
(
port
,
()
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment