Giter Site home page Giter Site logo

courses's Introduction

courses-ada

Creating data

  1. You will need Go and PostgreSQL.

  2. After installing PostgreSQL do the following:

    sudo -u postgres -i // or psql postgres on macOS
    create user YOURUSERNAME with password 'YOURPASSWORD';
    create database  YOURDATBASENAME owner YOURUSERNAME;
    
  3. Inside database.json you need to alter

    {"username":"YOUR_DATABASE_NAME","password":"YOUR_PASSWORD","url":"localhost","dbname":"YOUR_DATABASE_NAME"}
    

    to match the according values that you used to create your user and database

  4. Run the command go run main.go

    • This will create tables with the names meeting, courses, instructors, and grades.
    • It will also start a server listening out on port 8082. You can see the json that will be returned for terms here
  5. Inside the sql.sql file is where you'll find the data that will be populated into the database. So alter it as you please.

  6. To insert your new data from the SQL file, run the following command psql -d DATABASE_NAME -U USERNAME -W < sql.sql You should see something similar to:

    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    INSERT 0 1
    

    Also note that it will not check for duplicates so if you do not want that you will need to comment out what you do not want.

  7. To view your data in a colomn layout do the following psql -d DATABASE_NAME -U USER. Then select * from terms; and you should see data.

Dropping data

Run the following command to drop all tables created: psql -d DATABASE_NAME -U USERNAME -W < drop.sql

Modifying data

Note if you ever want to change data in you table. Do the following update TABLE set COLUMN = VALUE where id = ID_NUMBER_OF_ROW;

Running React code

  1. Install yarn
  2. Then, simply run yarn start from the base directory and it should open in your default browser

Running Go code

  1. Do a go get to install the golang postgresql driver
  2. Then go run main.go and the server will be started on port 8082

Credits

Thanks to Brandon Powell for a lot of help with the Go code.

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.