Giter Site home page Giter Site logo

myspace's Introduction

Myspace: a travel review website for space ๐ŸŒ ๐Ÿš€ ๐ŸŒž

because in space no one can hear you Yelp

User stories

  • On the welcome page I can search for planetary destinations by their distance from Earth

  • As a user I can a list of clickable search results, or choose to view all the options

  • As a user I can view individual planet pages and:

    • I can upvote planets
    • I can see reviews and add my own reviews
    • I can rate reviews, good or bad
  • SG I can log in

  • SG I can see a map of the planets

Requirements

  • Build an app using the Express framework.
  • Use a PostgreSQL database to store and retrieve your data.
  • Use the retrieved data to populate a Handlebars template for server-side rendering to be displayed on the front-end.
  • Include tests and set up code coverage.
  • Use Heroku or a similar service to host the app and the database.
  • Try to include ES6 syntax on the server.

Architecture

Put the database folder in the model folder.

Schema

Planets

Column Type
id serial primary key
name varchar(20)
distance float
description text
temperature integer
weather varchar(200)
interest integer
filename varchar(40)
thumbnailname varchar(40)

Reviews

Column Type
id serial primary key
planet_id integer references planets(id)
user varchar(20)
content text
likes integer
dislikes integer

Setup

To setup myspace with a database running on a local installation of PostgreSQL,

createdb myspace
sudo -u postgres createuser majortom
sudo -u postgres createdb myspace ```
and in `psql`,

GRANT ALL PRIVILEGES ON DATABASE myspace TO majortom ; ALTER USER majortom WITH PASSWORD 'milkymilkyway'; ``` Create a config.env for the project if you don't have one already and add to it the line

DB_TEST_URL = postgres://majortom:milkymilkyway@localhost:5432/myspace

Finally build the database:

npm run dbinit

Learnings & Links

  • Express makes most things simpler but routing in express carries its own new risk of bugs.
  • transform-origin is kewl.
  • :after allows you to define CSS properties to be applied after others, so they will take effect no matter what the properties are changed to previously.

myspace's People

Contributors

ameliejyc avatar morkeltry avatar azayneeva avatar rogeredbacon avatar

Watchers

James Cloos avatar Jen Spencer avatar  avatar  avatar  avatar

myspace's Issues

Testing setup

@ameliejyc @azayneeva We discussed this already but for historical note I think in the future rather than replicate your entire database setup for testing I would suggest changing the connection in dbuild depending on the desired environment

Pics

Your assets should all be save together in the folder served by your express.static middleware without outlying files in your handlebars directory

Use handlebars each method

https://github.com/FAC-11/myspace/blob/master/src/views/home.hbs#L7 could have been written in a DRYer way.

Something like this:

{{#each ["5", "10", "15", "20", "25", "30"]}}
    <li><button class="distance-li__link" name="distance" value="{{this}}" onclick="window.location.href='/results/{{this}}'">{{this}}au</button></li>
{{/each}}

Or something like that. This is quite a trivial example, but making more use of these helpers in general will help your projects

SQL Queries

When it comes to SQL queries it is best to write out the full queries even if it leads to verbosity rather than attempt to compose or concatenate strings as in practice your sql would be written for all the different situations and used where necessary.

begin TDD

by writing tests and then running them

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.