Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7187982
app.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
868 B
Referenced Files
None
Subscribers
None
app.ts
View Options
import
Koa
from
"koa"
;
import
Router
from
"@koa/router"
;
import
KoaResponsiveImageRouter
from
"../src/index"
;
const
app
=
new
Koa
();
const
router
=
new
Router
();
const
imageRouter
=
new
KoaResponsiveImageRouter
(
"/static/images"
,
"/tmp/images"
);
router
.
get
(
"/"
,
async
(
ctx
)
=>
{
ctx
.
body
=
`<p>it works</p>
${
await
imageRouter
.
image
({
resolutions
:
[
100
,
500
,
1000
,
1500
],
sizes_attr
:
"(max-width: 900px) 100vw, 900px"
,
path
:
"/home/arkadiusz/projects/sealcode/responsive-image-router/example/image.png"
,
}
)}
${
await
imageRouter
.
image
({
resolutions
:
[
2000
,
3000
,
1000
,
6000
],
sizes_attr
:
"(max-width: 900px) 100vw, 900px"
,
path
:
"/home/arkadiusz/projects/sealcode/responsive-image-router/example/image.png"
,
}
)}`
;
});
router
.
use
(
"/static/images"
,
imageRouter
.
getRoutes
());
app
.
use
(
router
.
routes
()).
use
(
router
.
allowedMethods
()).
listen
(
3005
);
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Tue, Jul 8, 07:48 (14 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
665778
Default Alt Text
app.ts (868 B)
Attached To
Mode
rRIMAGEROUTER koa-responsive-image-router
Attached
Detach File
Event Timeline
Log In to Comment