π¨ Node.js, Typescript and Express simple CRUD API
docker pull postgres:latest
docker run -d βname test-crud -p 5432:5432 -e 'POSTGRES_PASSWORD=openpgpwd' postgres
npm run initdb
npm start
Check your Hello World message on localhost:8080
-
Open any API client such as Postman
-
Add
Authorization: 1
to Headers -
Set Body format to
x-www-form-urlencoded
-
Add name, surname, title and content with dummy text to Body
-
Try the endpoints listed below:
-
USERS
-
GET localhost:8080/api/users
-
GET localhost:8080/api/users/USER_ID
-
POST localhost:8080/api/users
-
PUT localhost:8080/api/users/USER_ID
-
DELETE localhost:8080/api/users/USER_ID
-
-
POSTS
-
GET localhost:8080/api/posts
-
GET localhost:8080/api/posts/POST_ID
-
POST localhost:8080/api/posts
-
PUT localhost:8080/api/posts/POST_ID
-
DELETE localhost:8080/api/posts/POST_ID
-
-
CHECK POST LIKES
-
GET localhost:8080/api/posts/POST_ID/likes
-
-
LIKE/UNLIKE POST
-
POST localhost:8080/api/like/POST_ID
-
npm run test