Free fake API, written with Golang for testing and prototyping.
Are you tired of spending valuable time registering for complex APIs when all you need is some data for testing or prototyping?
Introducing Porsche API – a lightweight Golang-based API, designed to provide quick and easy access to dummy data without the hassle of registration or complex API documentation.
- No registration
- Basic API
- Cross-domain
- Supports GET, POST, PUT, DELETE
- HTTP
- Compatible with React, Angular, Vue, Ember, ...
Before you dive in, make sure to set up your environment variables by following these steps:
-
Clone the project: Open your terminal and clone our project repository by running the following command:
git clone https://github.com/vitolinho/dev-ops.git -
Grab the
.env.example: Head over to your project directory and find the.env.examplefile. This serves as a template for your environment variables. -
Fill in the
.envfile: Duplicate the.env.examplefile and rename it to.env. Open it up and fill in the required values based on your setup. Don't worry, the example file provides hints on what each variable should be set to. -
Ready to Launch!: Once your
.envfile is properly filled, you're almost ready to go! -
Start Docker: If you haven't already, make sure you have Docker installed. Install Docker if you haven't already.
-
Run the command: In your terminal, simply execute
make upordocker-compose up -d --buildto start up your local environment.
To provision infrastructure using Terraform, follow these steps:
-
Configure your Terraform variables: Ensure that the required values are set in
terraform/terraform.tfvars:aws_access_key = "YOUR_AWS_ACCESS_KEY" aws_secret_key = "YOUR_AWS_SECRET" ssh_user = "YOUR_SSH_USER"
-
Configure your GitHub token:
Ensure that your personal access token is set interraform/ansible/vars.yml:github_token: "YOUR_GITHUB_TOKEN"
You can generate a new GitHub token by visiting GitHub Tokens, clicking on Generate new token (classic), giving it a name, and selecting the admin:public_key option.
-
Initialize Terraform:
terraform init -
Plan your changes (optional but recommended to preview changes):
terraform plan -
Apply changes to provision infrastructure:
terraform apply -auto-approve -
Destroy infrastructure (if needed):
terraform destroy -auto-approve -
SSH into a newly created server:
If you wish to connect to one of the created servers via SSH, automatically generatedmakecommands are available. For example:
make ssh-dev-germany-instance
This command allows you to quickly access the server without manually specifying SSH parameters.
Ansible is automatically triggered by Terraform during the infrastructure provisioning process. However, if modifications are made to the Ansible configuration, you can run it manually. Below is an example command to execute Ansible manually:
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook \
-i ansible/inventory/prod-germany-instance \
-u {ssh_user} \
--private-key keys/prod-germany-instance-key.pem \
ansible/playbook.ymlFirst install the linter with this command
cd api/scripts
./setup.shRun the linter with this command:
cd api
golangci-lint run- Fill
.env.testfile - Run these commands:
cd api
make up
go test ./... -vPorsche-api comes with a set of 1 common resource:
/cars 50 cars
GET, POST, PUT, DELETE HTTP methods are supported. You can use http for your requests.
GET /api/v1/cars
GET /api/v1/cars/1
POST /api/v1/cars
PUT /api/v1/cars/1
DELETE /api/v1/cars/1
Install dependencies & run development server
cd client
pnpm install
pnpm dev
To access client development server go to http://localhost:5173
