Reljod-Portfolio-Backend

command module
v0.0.0-...-cdc5add Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

README

Reljod's Repository

License

Golang Icon

API Backend for my own personal Portfolio written in Golang.

Sections

Rest API

In local, you can find the Swagger examples at http://localhost:8888/swagger/index.html Swagger Example Endpoints as of now:

  1. Personal Info Endpoints.
  2. Heap Endpoints.

Data Structures and Algorithms

The code can be found under the folder ./app/algo/...

  • Data Structures Implemented so far:

    • List
    • Tuple
    • Heap
  • Algorithms Implemented so far:

    • Heap build and Heap sort.

Design Patterns

The code can be found under the folder ./app/designpattern/...

  • Design Patterns implemented so far:
    • Adapter Design Pattern

Best Practices

Local Development

  1. Git Clone the repo.
  2. Install Go from the official Golang install link here
  3. Under the root folder, run go mod tidy
  4. Run
    1. To run the Rest API, run the main.go under the root folder. Then access the swagger under http://localhost:8888.
          Example:
          go run main.go
      
    2. To execute the algorithms, design pattern examples, run the code under exec/...
          Example:
          go run exec/<folder>/<filename.go>
      
  5. (Important) Configure Environmental Variables to change the api behavior. The environmental behaviors can be found in config.env. As of now, PORT and logging level can be set by config.env.
    • (Important) Set DATABASE_URL to MongoDB URL as currently, the application uses MongoDB as its NoSQL Database.

Testing

  • Simply run go test -v ./... to test all available tests in the Repo.

Benchmark

  • Simply run go test -v -benchmem -bench "." "./..." to test all available benchmark tests in the Repo.

VSCode Guide

If we're using VSSCode in our development, follow the instructions below to easily execute Go script or run the local server.

  1. At the top section, click Run then Add configurations.
    VSCode Guide 1
  2. Click the Add configuration. This should add the launch.json file under .vscode folder.
    VSCode Guide 2
  3. Edit the launch.json file and use the configuration below:
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Connect to server",
            "type": "go",
            "request": "attach",
            "mode": "remote",
            "remotePath": "${workspaceFolder}",
            "port": 8888,
            "host": "127.0.0.1",
        },
        {
            "name": "Launch Package",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${fileDirname}",
            "env": {
                "DATABASE_URL": "<database_url>" // ask this to the owner.
            }
        }
    ]
}
  1. To run the script, just open the file that you want to run and click ctrl + F5 or Run without Debugging.

Contacts

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL