forked from Hetal2425/testNodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocumentFile-TestTask.txt
More file actions
35 lines (23 loc) · 1.78 KB
/
Copy pathdocumentFile-TestTask.txt
File metadata and controls
35 lines (23 loc) · 1.78 KB
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
----------------------------nodejs typescript test task with the use of typeorm --------------------------------------------
>>>> Create migration.ts file into src/migration folder
* Migration.ts includes query of create 'user' table
* Migration run command >>>> ts-node node_modules\typeorm\cli.js migration:run
* Migration revert command >>>> ts-node node_modules\typeorm\cli.js migration:revert
=>Create index.ts file in src folder
* its included http serverless packages
* its included route-methods which is GetMethod, PostMethod, PatchMethod, DeleteMethod
* controller.ts file which is include all the calls from index file
>>>> Create databaseConnection.ts file
* In databaseConnection.ts file database connection string added which is included type, database name, port number, host strings.
>>>> controller.ts
* which is include all method calls from index.ts file
* GetMethod is for get the data from database when get request send with payload>>>> GET http://localhost:3000/user?id={userId}&phoneNumber={phoneNumber}
if userId and mobile number not define in url than get whole data from user table >>>> GET http://localhost:3000/user
* is for new data add into user table
for PostMethod url request is post and url formate is >>>> POST http://localhost:3000/user
and in postman go to>>>> body >>>> row and write data and send.
* is for update the data into user table
url formate for patch is >>>> PATCH http://localhost:3000/user?id={userId}&phoneNumber={phoneNumber}
* is for delete data which is define into url with id and phoneNumber
url formate for delete >>>> DELETE http://localhost:3000/user?id={userId}&phoneNumber={phoneNumber}
* all method is 'validated' and send appropriate status error messages