Wires #3: Local Setup and Development Tools

In this blog, we will install all the tools, development packages and to test you’ll create a simple server in C#.

Since i am developing this project on my archlinux btw, with very minimal setup tools, I won’t use any bloated IDEs. Feel free to use whatever you want! Before getting started, make sure to install:

  • git
  • go
  • dotnet
  • docker
  • docker-compose

I will structure my project as modules, each module has other sub modules.

1
2
3
4
5
.
├── backend/
├── engine/
├── frontend/
└── README.md

I am writing the backend in go and C#, for me here are my installed vesions.

  • C# for the web API: .NET 8.0.100.
  • Go for the simulation engine: 1.21.5 linux/amd64
  • Docker and docker-compose : 24.0.7, 2.23.3

Let’s create the initial backend, we’ll use : dotent new webapi to create a barebone API.

As it’s shown below, the template API created by .NET has one simple GET route called : /weatherforecast which returns random values.

/posts/wires_3/backend.png
The init API

.NET creates launchSettings:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
    "http": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": true,
      "launchUrl": "swagger",
      "applicationUrl": "http://localhost:5086",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },

Let’s run (dotnet run) and call the API:

/posts/wires_3/api_call.png
Calling the API for the first time!

Let’s create a simple go project, contains just single main.go. Make sure to run : go mod init github.com/AYehia0/wires/engine

This creates a file called go.mod (will contain all the dependencies)

1
2
3
4
5
6
7
package main

import "fmt"

func main() {
	fmt.Println("Engine has been started!")
}

Run the engine using : go run .

As I am a backend guy + I hate frontend frameworks, I will force myself to use the easiest thing ever (not vanila JS). Idk now lol