A RESTful API example for simple contacts and adress CRUD operation built with Typescript, Express, and Prisma. Included with CI using Github Actions and automatic push on Dockerhub. My own version of Programmer Zaman Now belajar-typescript-restful-api.
- Copy .env.example to .env
cp .env.example .env
- Run the app with Docker
docker compose up
# or
docker-compose up
# API Endpoint : http://127.0.0.1:3000 or set the port according to your .env
# basePath is default to api/v1/
.
├── __test__/
├── .github
├── prisma/
│ └── migrations
├── src/
│ ├── application/
│ ├── controller/
│ ├── error/
│ ├── middleware/
│ ├── model/
│ ├── router/
│ ├── service/
│ ├── types/
│ ├── validation/
│ └── main.ts
├── .env
├── package.json
├── babel.config.json
├── tsconfig.json
├── docker-compose.yml
└── Dockerfile
POST
: Registering an user
POST
: Getting a token from registered user
GET
: Getting an user info (username, name, password)
GET
: Updating user info (username, name, password)
GET
: Getting all contacts with pagination and search parameterPOST
: Creatin a contact
GET
: Getting a contact by idPUT
: Updating a contact specified by contact idDELETE
: Deleting a contact specified by id
GET
: Getting all address within specified contactPOST
: Creatin an address for specified contact
PUT
: Updating an address specified by address idDELETE
: Deleting an address specified by address id