Git Product home page Git Product logo

backend's Introduction

backend

Tamiat CMS backend

Instructions applied on linux os

Prerequisites

  • Golang 1.6 or higher You may use these steps to install go on your Linux machine or use the previous link to get the latest versions of go.
    1. Open your terminal and make sure you are at home path
    2. Download the go package. wget https://go.dev/dl/go1.17.7.linux-amd64.tar.gz
    3. Extract go files sudo tar -C /usr/local -xzf go1.17.7.linux-amd64.tar.gz
    4. Add the following line to /home/<your_username/.profile file by using your preferred text editor. export PATH=$PATH:/usr/local/go/bin
    5. To apply the changes made to .proile file run: source $HOME/.profile
    6. Make sure you installed go by running: go version You will get output message like this: go version go1.17.7 linux/amd64
  • Postgresql Follow the instructions here: (https://www.postgresql.org/download/)

Setting up the project

  1. Clone the repository at any path git clone https://github.com/tamiat/backend.git
  2. cd backend
  3. Create postgresql database and set password for postgres user
    • sudo -i -u postgres
    • psql
    • CREATE DATABASE <database_name>;
    • ALTER USER postgres WITH PASSWORD '<new_password>';
  4. (Optional) you can use the following instructions to create the database with a different user: sudo -u postgres psql postgres CREATE ROLE <username> LOGIN PASSWORD 'new_password'; CREATE DATABASE <database_name> WITH OWNER = <username> SHOW port this gives you the DBPORT
  5. type exit twice to return to the terminal.
  6. At backend directory rename .env.example file to .env mv .env.example .env This file contains all necessarily environment variables.
Environment Variable Explanation
HOST ex: localhost
DBNAME database name
DBPASS database password
DBPORT database port, set to 5432
PORT which port number to use for endpoints, ex: 8080
DBUSER database user, ex: postgres
JWT_SECRET string to set secret of jwt
EMAIL_SENDER the email that will send confirmation emails to users. It should be activated in sendgrid profile
TEMPLATE_ID which template id sendgrid uses as a format to send emails
SENDGRID_API_KEY api key associated with the sender account
Sendgrid is a thirdparty we use to send emails
  1. Set environment variables using your preferred text editor
  2. Back to backend directory, run: go get github.com/gobuffalo/pop/...
  3. Edit ~/.profile and add this line into it. export PATH=$PATH:~/go/bin
  4. Run the following command to apply changes to .profile source ~/.profile
  5. Run the following command which soda It should give output like this: /home/<user_name>/go/bin/soda
  6. Now run the following to create all database tables soda migrate up

Running instructions

In the project root directory run go run main.go

backend's People

Contributors

mahnouman avatar marwangalal746 avatar odetolakehinde avatar rahmayasser avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.