-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.js
777 lines (671 loc) · 27.3 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
import { PassThrough } from 'stream';
import compression from '@fastify/compress';
import createError from 'http-errors';
import pino from 'pino';
import cors from '@fastify/cors';
import jwt from '@fastify/jwt';
import eik from '@eik/core';
import SinkMemory from '@eik/sink-memory';
import SinkFileSystem from '@eik/sink-file-system';
import config from './config.js';
import * as utils from './utils.js';
/**
* @typedef {object} EikServiceOptions
* @property {import('@eik/sink').default} [sink]
* @property {import('pino').Logger} [logger]
* @property {import('@eik/sink').default} [customSink] [Deprecated] Use sink instead
* @property {string} [aliasCacheControl]
* @property {string} [notFoundCacheControl="public, max-age=5"]
* @property {number} [pkgMaxFileSize=10000000] The limit in bytes before PUT /pkg/ starts returning 413 Content Too Large
* @property {number} [mapMaxFileSize=1000000] The limit in bytes before PUT /map/ starts returning 413 Content Too Large
*/
const EikService = class EikService {
/**
* @param {EikServiceOptions} [options={}]
*/
constructor(options = {}) {
let { sink, logger } = options;
const {
customSink,
notFoundCacheControl,
aliasCacheControl,
pkgMaxFileSize,
mapMaxFileSize,
} = options;
this._notFoundCacheControl =
notFoundCacheControl || 'public, max-age=5';
if (!logger) {
// @ts-expect-error This is in fact callable
logger = pino({
// @ts-ignore
level: config.get('log.level'),
name: config.get('name'),
});
}
if (sink) {
logger.info(`Using the provided sink ${sink.constructor.name}`);
} else if (customSink) {
logger.warn(
'The `customSink` option is deprecated and will be removed at a later stage. Use `sink` to remove this warning.',
);
sink = customSink;
} else if (config.get('sink.type') === 'mem') {
logger.info(
`Server is running with a in memory sink. Uploaded files will be lost on restart!`,
);
sink = new SinkMemory();
} else {
logger.info(
`Server is running with the file system sink. Uploaded files will be stored under "${config.get('sink.path')}"`,
);
sink = new SinkFileSystem({
sinkFsRootPath: config.get('sink.path'),
});
}
// Transform organization config
const organizations = config
.get('organization.hostnames')
.map((hostname) => [hostname, config.get('organization.name')]);
this._versionsGet = new eik.http.VersionsGet({
organizations,
sink,
logger,
});
this._aliasPost = new eik.http.AliasPost({
organizations,
sink,
logger,
});
this._aliasDel = new eik.http.AliasDel({ organizations, sink, logger });
this._aliasGet = new eik.http.AliasGet({
organizations,
sink,
logger,
cacheControl: aliasCacheControl,
});
this._aliasPut = new eik.http.AliasPut({ organizations, sink, logger });
this._authPost = new eik.http.AuthPost({
organizations,
logger,
authKey: config.get('basicAuth.key'),
});
this._pkgLog = new eik.http.PkgLog({ organizations, sink, logger });
this._pkgGet = new eik.http.PkgGet({ organizations, sink, logger });
this._pkgPut = new eik.http.PkgPut({
organizations,
sink,
logger,
pkgMaxFileSize,
});
this._mapGet = new eik.http.MapGet({ organizations, sink, logger });
this._mapPut = new eik.http.MapPut({
organizations,
sink,
logger,
mapMaxFileSize,
});
const mergeStreams = (...streams) => {
const str = new PassThrough({ objectMode: true });
// Avoid hitting the max listeners limit when multiple
// streams is piped into the same stream.
str.on('pipe', () => {
str.setMaxListeners(str.getMaxListeners() + 1);
});
str.on('unpipe', () => {
str.setMaxListeners(str.getMaxListeners() - 1);
});
for (const stm of streams) {
stm.on('error', (err) => {
logger.error(err);
});
stm.pipe(str);
}
return str;
};
// pipe metrics
const metrics = mergeStreams(
this._versionsGet.metrics,
this._aliasPost.metrics,
this._aliasDel.metrics,
this._aliasGet.metrics,
this._aliasPut.metrics,
this._authPost.metrics,
this._pkgLog.metrics,
this._pkgGet.metrics,
this._pkgPut.metrics,
this._mapGet.metrics,
this._mapPut.metrics,
sink.metrics,
);
metrics.on('error', (err) => {
logger.error(err);
});
this.metrics = metrics;
this.config = config;
this.logger = logger;
this.sink = sink;
// Print warnings
if (
config.get('basicAuth.type') === 'key' &&
config.get('basicAuth.key') === config.default('basicAuth.key')
) {
logger.warn(
'Server is running with default basic authorization key configured! For security purposes, it is highly recommended to set a custom value!',
);
}
if (config.get('jwt.secret') === config.default('jwt.secret')) {
logger.warn(
'Server is running with default jwt secret configured! For security purposes, it is highly recommended to set a custom value!',
);
}
// Print info
const hosts = config.get('organization.hostnames').join(', ');
logger.info(
`Files for "${hosts}" will be stored in the "${config.get('organization.name')}" organization space`,
);
}
async health() {
const health = new eik.HealthCheck({
logger: this.logger,
sink: this.sink,
});
await health.check();
}
api() {
return (app, options, done) => {
if (!app.initialConfig.ignoreTrailingSlash) {
this.logger.warn(
'Fastify is configured with "ignoreTrailingSlash" set to "false". Its adviced to set "ignoreTrailingSlash" to "true"',
);
}
app.register(cors);
// Authentication
app.register(jwt, {
secret: config.get('jwt.secret'),
messages: {
badRequestErrorMessage:
'Autorization header is malformatted. Format is "Authorization: Bearer [token]"',
noAuthorizationInHeaderMessage:
'Autorization header is missing!',
authorizationTokenExpiredMessage:
'Authorization token expired',
authorizationTokenInvalid: 'Authorization token is invalid',
},
});
app.decorate('authenticate', async (request, reply) => {
try {
await request.jwtVerify();
} catch (error) {
reply.send(error);
}
});
const authOptions = {
preValidation: [app.authenticate],
};
// Handle multipart upload
const _multipart = Symbol('multipart');
function setMultipart(req, payload, cb) {
req.raw[_multipart] = true;
cb();
}
app.addContentTypeParser('multipart', setMultipart);
// Compression
app.register(compression, {
global: config.get('compression.global'),
});
// 404 handling
app.setNotFoundHandler((request, reply) => {
reply.header('cache-control', this._notFoundCacheControl);
reply.type('text/plain');
reply.code(404);
reply.send('Not found');
});
// Error handling
app.setErrorHandler((error, request, reply) => {
this.logger.debug(
'Error occured during request. Error is available on trace log level.',
);
this.logger.trace(error);
reply.header('cache-control', 'no-store');
if (error.statusCode) {
if (error.statusCode === 404) {
reply.header(
'cache-control',
this._notFoundCacheControl,
);
}
reply.send(error);
return;
}
reply.send(createError(error.statusCode || 500));
});
//
// Routes
//
const authPostRoutes = async (request, reply) => {
const outgoing = await this._authPost.handler(request.raw);
// Workaround due to .jwt.sign() being able to only
// deal with object literals for some reason :/
const body = JSON.parse(JSON.stringify(outgoing.body));
const token = app.jwt.sign(body, {
expiresIn: config.get('jwt.expire'),
});
reply.header('cache-control', outgoing.cacheControl);
reply.type(outgoing.mimeType);
reply.code(outgoing.statusCode);
reply.send({ token });
};
const pkgGetRoute = async (request, reply) => {
const params = utils.sanitizeParameters(request.raw.url);
const outgoing = await this._pkgGet.handler(
request.raw,
params.type,
params.name,
params.version,
params.extras,
);
reply.header('cache-control', outgoing.cacheControl);
reply.header('etag', outgoing.etag);
reply.type(outgoing.mimeType);
reply.code(outgoing.statusCode);
return reply.send(outgoing.stream);
};
const pkgLogRoute = async (request, reply) => {
const params = utils.sanitizeParameters(request.raw.url);
const outgoing = await this._pkgLog.handler(
request.raw,
params.type,
params.name,
params.version,
);
reply.header('cache-control', outgoing.cacheControl);
reply.header('etag', outgoing.etag);
reply.type(outgoing.mimeType);
reply.code(outgoing.statusCode);
return reply.send(outgoing.stream);
};
const versionsGetRoute = async (request, reply) => {
const params = utils.sanitizeParameters(request.raw.url);
const outgoing = await this._versionsGet.handler(
request.raw,
params.type,
params.name,
);
reply.header('cache-control', outgoing.cacheControl);
reply.header('etag', outgoing.etag);
reply.type(outgoing.mimeType);
reply.code(outgoing.statusCode);
return reply.send(outgoing.stream);
};
const pkgPutRoute = async (request, reply) => {
const params = utils.sanitizeParameters(request.raw.url);
const outgoing = await this._pkgPut.handler(
request.raw,
request.user,
params.type,
params.name,
params.version,
);
reply.header('cache-control', outgoing.cacheControl);
reply.type(outgoing.mimeType);
reply.code(outgoing.statusCode);
reply.redirect(outgoing.location);
};
const mapGetRoute = async (request, reply) => {
const params = utils.sanitizeParameters(request.raw.url);
const outgoing = await this._mapGet.handler(
request.raw,
params.name,
params.version,
);
reply.header('cache-control', outgoing.cacheControl);
reply.header('etag', outgoing.etag);
reply.type(outgoing.mimeType);
reply.code(outgoing.statusCode);
return reply.send(outgoing.stream);
};
const mapPutRoute = async (request, reply) => {
const params = utils.sanitizeParameters(request.raw.url);
const outgoing = await this._mapPut.handler(
request.raw,
request.user,
params.name,
params.version,
);
reply.header('cache-control', outgoing.cacheControl);
reply.type(outgoing.mimeType);
reply.code(outgoing.statusCode);
reply.redirect(outgoing.location);
};
const aliasGetRoute = async (request, reply) => {
const params = utils.sanitizeParameters(request.raw.url);
const outgoing = await this._aliasGet.handler(
request.raw,
params.type,
params.name,
params.alias,
params.extras,
);
reply.header('cache-control', outgoing.cacheControl);
reply.type(outgoing.mimeType);
reply.code(outgoing.statusCode);
reply.redirect(outgoing.location);
};
const aliasPutRoute = async (request, reply) => {
const params = utils.sanitizeParameters(request.raw.url);
const outgoing = await this._aliasPut.handler(
request.raw,
request.user,
params.type,
params.name,
params.alias,
);
reply.header('cache-control', outgoing.cacheControl);
reply.type(outgoing.mimeType);
reply.code(outgoing.statusCode);
reply.redirect(outgoing.location);
};
const aliasPostRoute = async (request, reply) => {
const params = utils.sanitizeParameters(request.raw.url);
const outgoing = await this._aliasPost.handler(
request.raw,
request.user,
params.type,
params.name,
params.alias,
);
reply.header('cache-control', outgoing.cacheControl);
reply.type(outgoing.mimeType);
reply.code(outgoing.statusCode);
reply.redirect(outgoing.location);
};
const aliasDelRoute = async (request, reply) => {
const params = utils.sanitizeParameters(request.raw.url);
const outgoing = await this._aliasDel.handler(
request.raw,
request.user,
params.type,
params.name,
params.alias,
);
reply.header('cache-control', outgoing.cacheControl);
reply.type(outgoing.mimeType);
reply.code(outgoing.statusCode);
reply.send(outgoing.body);
};
//
// Authentication
//
// curl -X POST -i -F key=foo http://localhost:4001/auth/login
app.post(`/${eik.prop.base_auth}/login`, authPostRoutes);
//
// Packages
//
// Get public package - scoped
// curl -X GET http://localhost:4001/pkg/@cuz/fuzz/8.4.1/main/index.js
app.get(
`/${eik.prop.base_pkg}/@:scope/:name/:version/*`,
pkgGetRoute,
);
// Get public package - non-scoped
// curl -X GET http://localhost:4001/pkg/fuzz/8.4.1/main/index.js
app.get(`/${eik.prop.base_pkg}/:name/:version/*`, pkgGetRoute);
// Get package overview - scoped
// curl -X GET http://localhost:4001/pkg/@cuz/fuzz/8.4.1/
app.get(
`/${eik.prop.base_pkg}/@:scope/:name/:version`,
pkgLogRoute,
);
// Get package overview - non-scoped
// curl -X GET http://localhost:4001/pkg/fuzz/8.4.1/
app.get(`/${eik.prop.base_pkg}/:name/:version`, pkgLogRoute);
// Get package versions - scoped
// curl -X GET http://localhost:4001/pkg/@cuz/fuzz/
app.get(`/${eik.prop.base_pkg}/@:scope/:name`, versionsGetRoute);
// Get package versions - non-scoped
// curl -X GET http://localhost:4001/pkg/fuzz/
app.get(`/${eik.prop.base_pkg}/:name`, versionsGetRoute);
// Put package - scoped
// curl -X PUT -i -F [email protected] http://localhost:4001/pkg/@cuz/fuzz/8.4.1/
app.put(
`/${eik.prop.base_pkg}/@:scope/:name/:version`,
authOptions,
pkgPutRoute,
);
// Put package - non-scoped
// curl -X PUT -i -F [email protected] http://localhost:4001/pkg/fuzz/8.4.1/
app.put(
`/${eik.prop.base_pkg}/:name/:version`,
authOptions,
pkgPutRoute,
);
//
// NPM Packages
//
// Get public NPM package - scoped
// curl -X GET http://localhost:4001/npm/@cuz/fuzz/8.4.1/main/index.js
app.get(
`/${eik.prop.base_npm}/@:scope/:name/:version/*`,
pkgGetRoute,
);
// Get public NPM package - non-scoped
// curl -X GET http://localhost:4001/npm/fuzz/8.4.1/main/index.js
app.get(`/${eik.prop.base_npm}/:name/:version/*`, pkgGetRoute);
// Get NPM package overview - scoped
// curl -X GET http://localhost:4001/npm/@cuz/fuzz/8.4.1/
app.get(
`/${eik.prop.base_npm}/@:scope/:name/:version`,
pkgLogRoute,
);
// Get NPM package overview - non-scoped
// curl -X GET http://localhost:4001/npm/fuzz/8.4.1/
app.get(`/${eik.prop.base_npm}/:name/:version`, pkgLogRoute);
// Get NPM package versions - scoped
// curl -X GET http://localhost:4001/npm/@cuz/fuzz/
app.get(`/${eik.prop.base_npm}/@:scope/:name`, versionsGetRoute);
// Get NPM package versions - non-scoped
// curl -X GET http://localhost:4001/npm/fuzz/
app.get(`/${eik.prop.base_npm}/:name`, versionsGetRoute);
// Put NPM package - scoped
// curl -X PUT -i -F [email protected] http://localhost:4001/npm/@cuz/fuzz/8.4.1/
app.put(
`/${eik.prop.base_npm}/@:scope/:name/:version`,
authOptions,
pkgPutRoute,
);
// Put NPM package - non-scoped
// curl -X PUT -i -F [email protected] http://localhost:4001/npm/fuzz/8.4.1/
app.put(
`/${eik.prop.base_npm}/:name/:version`,
authOptions,
pkgPutRoute,
);
//
// Import Maps
//
// Get map - scoped
// curl -X GET http://localhost:4001/map/@cuz/buzz/4.2.2
app.get(
`/${eik.prop.base_map}/@:scope/:name/:version`,
mapGetRoute,
);
// Get map - non-scoped
// curl -X GET http://localhost:4001/map/buzz/4.2.2
app.get(`/${eik.prop.base_map}/:name/:version`, mapGetRoute);
// Get map versions - scoped
// curl -X GET http://localhost:4001/map/@cuz/buzz
app.get(`/${eik.prop.base_map}/@:scope/:name`, versionsGetRoute);
// Get map versions - non-scoped
// curl -X GET http://localhost:4001/map/buzz
app.get(`/${eik.prop.base_map}/:name`, versionsGetRoute);
// Put map - scoped
// curl -X PUT -i -F [email protected] http://localhost:4001/map/@cuz/buzz/4.2.2
app.put(
`/${eik.prop.base_map}/@:scope/:name/:version`,
authOptions,
mapPutRoute,
);
// Put map - non-scoped
// curl -X PUT -i -F [email protected] http://localhost:4001/map/buzz/4.2.2
app.put(
`/${eik.prop.base_map}/:name/:version`,
authOptions,
mapPutRoute,
);
//
// Alias Packages
//
// curl -X GET -L http://localhost:4001/pkg/@cuz/fuzz/v8
app.get(
`/${eik.prop.base_pkg}/@:scope/:name/v:alias`,
aliasGetRoute,
);
// curl -X GET -L http://localhost:4001/pkg/fuzz/v8
app.get(`/${eik.prop.base_pkg}/:name/v:alias`, aliasGetRoute);
// curl -X GET -L http://localhost:4001/pkg/@cuz/fuzz/v8/main/index.js
app.get(
`/${eik.prop.base_pkg}/@:scope/:name/v:alias/*`,
aliasGetRoute,
);
// curl -X GET -L http://localhost:4001/pkg/fuzz/v8/main/index.js
app.get(`/${eik.prop.base_pkg}/:name/v:alias/*`, aliasGetRoute);
// curl -X PUT -i -F version=8.4.1 http://localhost:4001/pkg/@cuz/fuzz/v8
app.put(
`/${eik.prop.base_pkg}/@:scope/:name/v:alias`,
authOptions,
aliasPutRoute,
);
// curl -X PUT -i -F version=8.4.1 http://localhost:4001/pkg/fuzz/v8
app.put(
`/${eik.prop.base_pkg}/:name/v:alias`,
authOptions,
aliasPutRoute,
);
// curl -X POST -i -F version=8.4.1 http://localhost:4001/pkg/@cuz/lit-html/v8
app.post(
`/${eik.prop.base_pkg}/@:scope/:name/v:alias`,
authOptions,
aliasPostRoute,
);
// curl -X POST -i -F version=8.4.1 http://localhost:4001/pkg/lit-html/v8
app.post(
`/${eik.prop.base_pkg}/:name/v:alias`,
authOptions,
aliasPostRoute,
);
// curl -X DELETE http://localhost:4001/pkg/@cuz/fuzz/v8
app.delete(
`/${eik.prop.base_pkg}/@:scope/:name/v:alias`,
authOptions,
aliasDelRoute,
);
// curl -X DELETE http://localhost:4001/pkg/fuzz/v8
app.delete(
`/${eik.prop.base_pkg}/:name/v:alias`,
authOptions,
aliasDelRoute,
);
//
// Alias NPM Packages
//
// curl -X GET -L http://localhost:4001/npm/@cuz/fuzz/v8
app.get(
`/${eik.prop.base_npm}/@:scope/:name/v:alias`,
aliasGetRoute,
);
// curl -X GET -L http://localhost:4001/npm/fuzz/v8
app.get(`/${eik.prop.base_npm}/:name/v:alias`, aliasGetRoute);
// curl -X GET -L http://localhost:4001/npm/@cuz/fuzz/v8/main/index.js
app.get(
`/${eik.prop.base_npm}/@:scope/:name/v:alias/*`,
aliasGetRoute,
);
// curl -X GET -L http://localhost:4001/npm/fuzz/v8/main/index.js
app.get(`/${eik.prop.base_npm}/:name/v:alias/*`, aliasGetRoute);
// curl -X PUT -i -F version=8.4.1 http://localhost:4001/npm/@cuz/fuzz/v8
app.put(
`/${eik.prop.base_npm}/@:scope/:name/v:alias`,
authOptions,
aliasPutRoute,
);
// curl -X PUT -i -F version=8.4.1 http://localhost:4001/npm/fuzz/v8
app.put(
`/${eik.prop.base_npm}/:name/v:alias`,
authOptions,
aliasPutRoute,
);
// curl -X POST -i -F version=8.4.1 http://localhost:4001/npm/@cuz/lit-html/v8
app.post(
`/${eik.prop.base_npm}/@:scope/:name/v:alias`,
authOptions,
aliasPostRoute,
);
// curl -X POST -i -F version=8.4.1 http://localhost:4001/npm/lit-html/v8
app.post(
`/${eik.prop.base_npm}/:name/v:alias`,
authOptions,
aliasPostRoute,
);
// curl -X DELETE http://localhost:4001/npm/@cuz/fuzz/v8
app.delete(
`/${eik.prop.base_npm}/@:scope/:name/v:alias`,
authOptions,
aliasDelRoute,
);
// curl -X DELETE http://localhost:4001/npm/fuzz/v8
app.delete(
`/${eik.prop.base_npm}/:name/v:alias`,
authOptions,
aliasDelRoute,
);
//
// Alias Import Maps
//
// curl -X GET -L http://localhost:4001/map/@cuz/buzz/v4
app.get(
`/${eik.prop.base_map}/@:scope/:name/v:alias`,
aliasGetRoute,
);
// curl -X GET -L http://localhost:4001/map/buzz/v4
app.get(`/${eik.prop.base_map}/:name/v:alias`, aliasGetRoute);
// curl -X PUT -i -F version=4.2.2 http://localhost:4001/map/@cuz/buzz/v4
app.put(
`/${eik.prop.base_map}/@:scope/:name/v:alias`,
authOptions,
aliasPutRoute,
);
// curl -X PUT -i -F version=4.2.2 http://localhost:4001/map/buzz/v4
app.put(
`/${eik.prop.base_map}/:name/v:alias`,
authOptions,
aliasPutRoute,
);
// curl -X POST -i -F version=4.4.2 http://localhost:4001/map/@cuz/buzz/v4
app.post(
`/${eik.prop.base_map}/@:scope/:name/v:alias`,
authOptions,
aliasPostRoute,
);
// curl -X POST -i -F version=4.4.2 http://localhost:4001/map/buzz/v4
app.post(
`/${eik.prop.base_map}/:name/v:alias`,
authOptions,
aliasPostRoute,
);
// curl -X DELETE http://localhost:4001/map/@cuz/buzz/v4
app.delete(
`/${eik.prop.base_map}/@:scope/:name/v:alias`,
authOptions,
aliasDelRoute,
);
// curl -X DELETE http://localhost:4001/map/buzz/v4
app.delete(
`/${eik.prop.base_map}/:name/v:alias`,
authOptions,
aliasDelRoute,
);
done();
};
}
};
export default EikService;