Skip to content

Commit 1dfa1dc

Browse files
committed
remove v1 from urls
1 parent a3411bf commit 1dfa1dc

File tree

11 files changed

+20
-20
lines changed

11 files changed

+20
-20
lines changed

.vscode/tasks.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"args": [
4141
"-r",
4242
"${workspaceFolder}/.templates/route",
43-
"${workspaceFolder}/src/routes/v1/${input:routeName}"
43+
"${workspaceFolder}/src/routes/${input:routeName}"
4444
]
4545
},
4646
{

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,13 @@ The repository [**React.js Isomorphic Web Application Architecture**] has a comp
256256
```
257257

258258
## Directory Traversal for Signup API call
259-
`/src → server.ts → app.ts → /routes/v1/index.ts → /auth/apikey.ts → schema.ts → /helpers/validator.ts → asyncHandler.ts → /routes/v1/access/signup.ts → schema.ts → /helpers/validator.ts → asyncHandler.ts → /database/repository/UserRepo.ts → /database/model/User.ts → /core/ApiResponses.ts`
259+
`/src → server.ts → app.ts → /routes/index.ts → /auth/apikey.ts → schema.ts → /helpers/validator.ts → asyncHandler.ts → /routes/access/signup.ts → schema.ts → /helpers/validator.ts → asyncHandler.ts → /database/repository/UserRepo.ts → /database/model/User.ts → /core/ApiResponses.ts`
260260

261261
## API Examples
262262
* Signup
263263
* Method and Headers
264264
```
265-
POST /v1/signup/basic HTTP/1.1
265+
POST /signup/basic HTTP/1.1
266266
Host: localhost:3000
267267
x-api-key: GCMUDiuY5a7WvyUNt9n3QztToSHzK7Uj
268268
Content-Type: application/json
@@ -311,7 +311,7 @@ The repository [**React.js Isomorphic Web Application Architecture**] has a comp
311311
* Profile Private
312312
* Method and Headers
313313
```
314-
GET /v1/profile/my HTTP/1.1
314+
GET /profile/my HTTP/1.1
315315
Host: localhost:3000
316316
x-api-key: GCMUDiuY5a7WvyUNt9n3QztToSHzK7Uj
317317
Content-Type: application/json

src/app.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
InternalError,
1111
ErrorType,
1212
} from './core/ApiError';
13-
import routesV1 from './routes';
13+
import routes from './routes';
1414

1515
process.on('uncaughtException', (e) => {
1616
Logger.error(e);
@@ -25,7 +25,7 @@ app.use(
2525
app.use(cors({ origin: corsUrl, optionsSuccessStatus: 200 }));
2626

2727
// Routes
28-
app.use('/v1', routesV1);
28+
app.use('/', routes);
2929

3030
// catch 404 and forward to error handler
3131
app.use((req, res, next) => next(new NotFoundError()));

tests/auth/apikey/unit.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import app from '../../../src/app';
55
import supertest from 'supertest';
66

77
describe('apikey validation', () => {
8-
const endpoint = '/v1/dummy/test';
8+
const endpoint = '/dummy/test';
99
const request = supertest(app);
1010

1111
beforeEach(() => {

tests/auth/authentication/unit.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import app from '../../../src/app';
1515
import supertest from 'supertest';
1616

1717
describe('authentication validation', () => {
18-
const endpoint = '/v1/profile/my/test';
18+
const endpoint = '/profile/my/test';
1919
const request = supertest(app);
2020

2121
beforeEach(() => {

tests/auth/authorization/unit.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import supertest from 'supertest';
1515
import { RoleCode } from '../../../src/database/model/Role';
1616

1717
describe('authentication validation for editor', () => {
18-
const endpoint = '/v1/blog/editor/test';
18+
const endpoint = '/blog/editor/test';
1919
const request = supertest(app);
2020

2121
beforeEach(() => {
@@ -37,7 +37,7 @@ describe('authentication validation for editor', () => {
3737
});
3838

3939
describe('authentication validation for writer', () => {
40-
const endpoint = '/v1/blog/writer/test';
40+
const endpoint = '/blog/writer/test';
4141
const request = supertest(app);
4242

4343
beforeEach(() => {

tests/routes/access/login/integration.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const userFindByEmailSpy = jest.spyOn(UserRepo, 'findByEmail');
1919
export const keystoreCreateSpy = jest.spyOn(KeystoreRepo, 'create');
2020

2121
describe('Login basic route', () => {
22-
const endpoint = '/v1/login/basic';
22+
const endpoint = '/login/basic';
2323
const request = supertest(app);
2424
const password = '123456';
2525

tests/routes/access/login/unit.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import supertest from 'supertest';
1717
import app from '../../../../src/app';
1818

1919
describe('Login basic route', () => {
20-
const endpoint = '/v1/login/basic';
20+
const endpoint = '/login/basic';
2121
const request = supertest(app);
2222

2323
beforeEach(() => {

tests/routes/access/signup/unit.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import supertest from 'supertest';
2121
import app from '../../../../src/app';
2222

2323
describe('Signup basic route', () => {
24-
const endpoint = '/v1/signup/basic';
24+
const endpoint = '/signup/basic';
2525
const request = supertest(app);
2626

2727
const email = '[email protected]';

tests/routes/blog/index/unit.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('BlogDetail by URL route', () => {
2626
});
2727

2828
const request = supertest(app);
29-
const endpoint = '/v1/blog/url';
29+
const endpoint = '/blog/url';
3030

3131
it('Should send error when endpoint query is not passed', async () => {
3232
const response = await addHeaders(request.get(endpoint));
@@ -107,7 +107,7 @@ describe('BlogDetail by id route', () => {
107107
});
108108

109109
const request = supertest(app);
110-
const endpoint = '/v1/blog/id/';
110+
const endpoint = '/blog/id/';
111111

112112
it('Should send error when invalid id is passed', async () => {
113113
const response = await addHeaders(request.get(endpoint + 'abc'));

tests/routes/blog/writer/unit.test.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('Writer blog create routes', () => {
2626
});
2727

2828
const request = supertest(app);
29-
const endpoint = '/v1/blog/writer';
29+
const endpoint = '/blog/writer';
3030

3131
it('Should send error if the user do have writer role', async () => {
3232
const response = await addAuthHeaders(request.post(endpoint));
@@ -214,7 +214,7 @@ describe('Writer blog submit routes', () => {
214214
});
215215

216216
const request = supertest(app);
217-
const endpoint = '/v1/blog/writer/submit/';
217+
const endpoint = '/blog/writer/submit/';
218218

219219
it('Should send error if submit blog id is not valid', async () => {
220220
const response = await addAuthHeaders(
@@ -258,7 +258,7 @@ describe('Writer blog withdraw routes', () => {
258258
});
259259

260260
const request = supertest(app);
261-
const endpoint = '/v1/blog/writer/withdraw/';
261+
const endpoint = '/blog/writer/withdraw/';
262262

263263
it('Should send error if withdraw blog id is not valid', async () => {
264264
const response = await addAuthHeaders(
@@ -302,7 +302,7 @@ describe('Writer blog delete routes', () => {
302302
});
303303

304304
const request = supertest(app);
305-
const endpoint = '/v1/blog/writer/id/';
305+
const endpoint = '/blog/writer/id/';
306306

307307
it('Should send error if deleting blog id is not valid', async () => {
308308
const response = await addAuthHeaders(
@@ -345,7 +345,7 @@ describe('Writer blog get by id routes', () => {
345345
});
346346

347347
const request = supertest(app);
348-
const endpoint = '/v1/blog/writer/id/';
348+
const endpoint = '/blog/writer/id/';
349349

350350
it('Should send error if fetching blog id is not valid', async () => {
351351
const response = await addAuthHeaders(

0 commit comments

Comments
 (0)