mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-02-17 23:45:29 -05:00
refactor(api): update user routes to use constants for endpoints (#5089)
This commit is contained in:
parent
7ee74706b4
commit
6a4f03b97b
1 changed files with 4 additions and 4 deletions
|
@ -12,7 +12,7 @@ import {
|
||||||
errorUtils,
|
errorUtils,
|
||||||
validatioUtils,
|
validatioUtils,
|
||||||
} from '@verdaccio/core';
|
} from '@verdaccio/core';
|
||||||
import { rateLimit } from '@verdaccio/middleware';
|
import { USER_API_ENDPOINTS, rateLimit } from '@verdaccio/middleware';
|
||||||
import { Logger } from '@verdaccio/types';
|
import { Logger } from '@verdaccio/types';
|
||||||
import { Config, RemoteUser } from '@verdaccio/types';
|
import { Config, RemoteUser } from '@verdaccio/types';
|
||||||
import { getAuthenticatedMessage, mask } from '@verdaccio/utils';
|
import { getAuthenticatedMessage, mask } from '@verdaccio/utils';
|
||||||
|
@ -23,7 +23,7 @@ const debug = buildDebug('verdaccio:api:user');
|
||||||
|
|
||||||
export default function (route: Router, auth: Auth, config: Config, logger: Logger): void {
|
export default function (route: Router, auth: Auth, config: Config, logger: Logger): void {
|
||||||
route.get(
|
route.get(
|
||||||
'/-/user/:org_couchdb_user',
|
USER_API_ENDPOINTS.get_user,
|
||||||
rateLimit(config?.userRateLimit),
|
rateLimit(config?.userRateLimit),
|
||||||
function (req: $RequestExtend, res: Response, next: $NextFunctionVer): void {
|
function (req: $RequestExtend, res: Response, next: $NextFunctionVer): void {
|
||||||
debug('verifying user');
|
debug('verifying user');
|
||||||
|
@ -70,7 +70,7 @@ export default function (route: Router, auth: Auth, config: Config, logger: Logg
|
||||||
* @param {Config} config
|
* @param {Config} config
|
||||||
*/
|
*/
|
||||||
route.put(
|
route.put(
|
||||||
'/-/user/:org_couchdb_user/:_rev?/:revision?',
|
USER_API_ENDPOINTS.add_user,
|
||||||
rateLimit(config?.userRateLimit),
|
rateLimit(config?.userRateLimit),
|
||||||
function (req: $RequestExtend, res: Response, next: $NextFunctionVer): void {
|
function (req: $RequestExtend, res: Response, next: $NextFunctionVer): void {
|
||||||
const { name, password } = req.body;
|
const { name, password } = req.body;
|
||||||
|
@ -168,7 +168,7 @@ export default function (route: Router, auth: Auth, config: Config, logger: Logg
|
||||||
);
|
);
|
||||||
|
|
||||||
route.delete(
|
route.delete(
|
||||||
'/-/user/token/*',
|
USER_API_ENDPOINTS.user_token,
|
||||||
function (req: $RequestExtend, res: Response, next: $NextFunctionVer): void {
|
function (req: $RequestExtend, res: Response, next: $NextFunctionVer): void {
|
||||||
res.status(HTTP_STATUS.OK);
|
res.status(HTTP_STATUS.OK);
|
||||||
next({
|
next({
|
||||||
|
|
Loading…
Add table
Reference in a new issue