A ToDo-API build with NestJS in the Distributed and Parallel Systems Course at HS-Esslingen.
This NestJS Application provides an REST-API to manage ToDos.
All CRUD Function are provided and Documented using Swagger (Available under /doc
).
- Pull the Docker Image
docker pull ghcr.io/freakeyplays/vs-lab-backend:<version>
- Run the Docker Image
# Use Deafault Environment Variables
docker run -p 8080:3000 ghcr.io/freakeyplays/vs-lab-backend:<version>
# Provide Environment Variables via the CL
docker run -e SERVER_PORT=5000 ... -p 8080:$SERVER_PORT ghcr.io/freakeyplays/vs-lab-backend:<version>
# Provide Envrionment Variables via .env File
docker run --env-file -p 8080:$SERVER_PORT ghcr.io/freakeyplays/vs-lab-backend:<version>
- Clone the Repository
git clone https://github.com/FreakeyPlays/vs-lab-backend.git
- Install Dependencies
npm install
-
Install a Local Postgres Database or Provide a connection via the Environment Variables
-
Run the Application in Development Mode
npm run start:dev
- Access the Application at
localhost:3000
Name | Type | Description | Default |
---|---|---|---|
SERVER_PORT |
number |
The Port to access the Application. When using Docker this is the Inside Port |
3000 |
POSTGRES_HOST |
string |
The Host where the Database is served. Example: www.example.com |
localhost |
POSTGRES_PORT |
number |
The Port of where the Database is served. | 5432 |
POSTGRES_USER |
string |
The Username to access Database. | postgres |
POSTGRES_PASSWORD |
string |
The Password to access the Database. | password |
POSTGRES_DB_NAME |
string |
The Name of the Database. | postgres |
curl -X 'POST' \
'${BASE_URL}/todos' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-d '{
"todo": "string",
"priority": 2
}'
{
"todo": String,
"priority": Number
}
curl -X 'GET' \
'${BASE_URL}/todos' \
-H 'accept: */*'
[
{
"todo": String,
"priority": Number
},
...
]
curl -X 'PUT' \
'${BASE_URL}/todos' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-d '{
"todo": "string",
"priority": 0
}'
{
"generatedMaps": Array,
"raw": Array,
"affected": Number
}
curl -X 'DELETE' \
'${BASE_URL}/todos' \
-H 'accept: */*'
{
"raw": Array,
"affected": Number
}
curl -X 'DELETE' \
'${BASE_URL}/todos/${todo}' \
-H 'accept: */*'
{
"raw": Array,
"affected": Number
}
curl -X 'DELETE' \
'${BASE_URL}/todos/${todo}' \
-H 'accept: */*'
{
"todo": String,
"priority": Number
}