Skip to content

itsHardStyl3r/the-swift-codes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Swift Codes project

This repository contains both backend and frontend, although frontend was out of the scope of this project.

go mariadb typescript vitejs pnpm

Running in docker (recommended)

0. Install docker or podman.

1. Clone the repository

Clone the repository using

git clone https://github.com/itsHardStyl3r/the-swift-codes

2. Setting up the environment (Important)

Edit .env file in root with following content (you can keep the values as shown):

MYSQL_ROOT_PASSWORD=password
MYSQL_DATABASE=swifties
MYSQL_USER=user
MYSQL_PASSWORD=password

and then another .env in ./backend:

csvDataPath=the-swift-codes.csv
dbUser=user
dbPassword=password
dbAddr=mariadb_db:3306
dbDatabase=swifties
httpListenOn=0.0.0.0:8080

3. Composing the container

In the root directory of the project run this command

docker-compose up

and you should be good to go. The database will start and set up first, then the backend.

Requirements / running manually

Backend is written in Go and uses mariadb. Frontend uses typescript and pnpm, so naturally you'd need node.js.

Installing Go

Follow detailed instructions on golang's website for all supported platforms.

  • Windows (10 or newer)

Alternatively to the aforementioned instructions, you can install go using scoop.sh. To install scoop, in powershell run:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression

and then

scoop install go

and go should be installed and added to your path.

  • Linux (apt package manager)

Update your package lists using

sudo apt update

and install golang-go with

apt install -y golang-go

and go should be installed on your system.

Installing node.js and pnpm

You can follow detailed instructions on nodejs.org webiste, especially for Linux.

  • Windows

Again, you can use scoop.sh to install both. Head above to see its installation details and once complete, run

scoop install nodejs-lts pnpm

and you're done. Alternatively, use winget as explained here.

Installing mariadb

  • Windows

Use scoop to install mariadb, run

scoop install mariadb

or follow instructions on mariadb website.

  • Linux (apt package manager)

Run

sudo apt update
sudo apt install -y mariadb-server

and then

sudo mysql_secure_installation

to configure the database.

Installation

Clone the repository in a desired place using:

git clone https://github.com/itsHardStyl3r/the-swift-codes

Installing backend

Change directory to ./backend and run

go mod tidy
go mod verify

Installing frontend

Change directory to ./frontend and run

pnpm install

Running the applications

Running backend

go run cmd/main.go

Running frontend

pnpm run dev

Running tests (backend only)

See backend README.

About

A task I've been given to test my abilities and I chose Go to learn the language.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors