Skip to content

codejockie/typescript-node-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typescript-node-api

Testing with cUrl

GET

curl --location --request GET 'localhost:3000/users' \
--header 'Content-Type: application/json'

POST

curl --location --request POST 'localhost:3000/users' \
--header 'Content-Type: application/json'
{
   "error": "Missing required fields email and/or password"
}
curl --location --request POST 'localhost:3000/users' \
--header 'Content-Type: application/json' \
--data-raw '{
   "email": "devjckennedy@gmail.com",
   "password": "Passw0rd!23"
}'
{
    "id": "hJgUcVUX7"
}

REST_API_EXAMPLE_ID="put_id_here"

curl --location --request GET "localhost:3000/users/$REST_API_EXAMPLE_ID" \
--header 'Content-Type: application/json'

PUT

curl --location --request PUT "localhost:3000/users/$REST_API_EXAMPLE_ID" \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "devjckennedy@gmail.com",
    "password": "Passw0rd!23",
    "firstName": "Kennedy",
    "lastName": "John",
    "permissionLevel": 8
}'

PATCH

curl --location --request PATCH "localhost:3000/users/$REST_API_EXAMPLE_ID" \
--header 'Content-Type: application/json' \
--data-raw '{
    "lastName": "James"
}'
[
  {
    "id": "hJgUcVUX7",
    "email": "devjckennedy@gmail.com",
    "password": "$argon2i$v=19$m=4096,t=3,p=1$sTpFisChUy3L6rYNzVb9HQ$fm2Dd5cy/7Dof0vv0WymRrktJG3CRzTJih5uWsf0ry8",
    "firstName": "Kennedy",
    "lastName": "James",
    "permissionLevel": 8
  }
]

DELETE

curl --location --request DELETE "localhost:3000/users/$REST_API_EXAMPLE_ID" \
--header 'Content-Type: application/json'

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published