Skip to content

giftxtrade/api

Repository files navigation

GiftTrade Logo

The platform that aims to simplify your online gift exchange and secret santa for free.


Tech stack

Instructions

Set up config files

db_config.json

This project also uses a PostgreSQL database in order to run. To start, create a file called db_config.json in the project root and place the following in the file, replacing all content within the [] with the correct database values:

{
    "host": "localhost",
    "dbName": "[database name]",
    "username": "[database username]",
    "password": "[database password]",
    "port": 5432
}

Note: All database table and column names are represented in snake_case. While all json field names are represented using camelCase.

tokens.json

In addition to the db_config.json, you will also need to create a tokens.json file which will hold the JWT secret, note that this token should be a randomly generated value and must not be made public. The token.json file should contain the following:

{
    "jwtKey": "[YOUR SECRET TOKEN]",
    "twitter": {
        "apiKey": "[Twitter OAuth 1.0 API Key]",
        "apiKeySecret": "[Twitter OAuth 1.0 API Secret]",
        "bearerToken": "[Twitter OAuth Bearer Token]",
        "callbackUrl": "http://localhost:8080/auth/twitter/callback"
    },
    "google": {
        "clientId": "[Google Client Id]",
        "clientSecret": "[Google Secret Key]",
        "callbackUrl": "http://localhost:8080/auth/google/callback"
    }
}

Generate Binary

$ make build

or

$ go build src/server.go

Creates an executable binary file called server. To run this file call ./server, like so:

$ ./server

This should start the server on port 8080.

Run without Binary

Another way to run the server is by using the make run command.

$ make run

Running the command should also start the server on port 8080. This command is equivalent to running go run src/server.go.