/go-challenge

Go Challenge with Vue, GoLang and CockorachDB

Primary LanguageGo

GO-challenge

Backend

  1. Create basic API REST to render domains. domain/yourdomain
  2. Once that we have the domain we can create:
  • GET request to SSLLABS to get the servers info. You can see the docs here.
  • GET request to ipInfo to get the country and the organization name (API Key generated and Env variable created). I tried with golang-packages but there are some issues.
  • GET request to metadata to get the image and the title of the webpage.
  1. Create Cockroach database

SQL commands.

CREATE USER IF NOT EXISTS juanc;
CREATE DATABASE domains;

GRANT ALL ON DATABASE domains TO juanc;

SET DATABASE = domains;
CREATE TABLE tbldomains(id SERIAL PRIMARY KEY, name VARCHAR, count INT);
INSERT INTO tbldomains (name, count) VALUES('pushdev',5);
SELECT * FROM tbldomains;
UPDATE tbldomains SET count = 5 WHERE id = '554066634883203073';
DROP TABLE tbldomains;
DELETE FROM tbldomains WHERE name='pushdev';

Frontend

  1. Install Vue. With nodejs run

How to run

  • Inside the project db folder run in a new Powershell cockroach start --insecure --listen-addr=localhost:26257 --http-addr=localhost:8080.
  • Open a new Powershell and inside the project db folder run cockroach sql --insecure.
  • go run environment.go main.go. Open http://localhost:8081/
  • npm run serve -- --port 3000. Open http://localhost:3000/

Enjoy!

Type the domain

image

See the results

image

image

Search history

image