Coder Social home page Coder Social logo

secrets's Introduction

Secrets

Secrets is an application where you can anonymously share your deepest, darkest secrets with the entire internet and have people comment on them. This is totally a good idea where nothing can go wrong.

The best part of this totally viable application is: you have to build it!

Before you get started:

  1. Make sure you have a database created in Postgres named secrets. You should be able to accomplish this by running createdb secrets in your terminal or using your Postgres GUI program (like Postico).

  2. Check out the hosted finished version of this application here: (https://thawing-waters-37617.herokuapp.com). This should give you clear direction in the necessary features and functionality. Oh, you should also share a secret with us ... please keep it clean. :)

  3. Check out the files you already have! You shouldn't have to write any HTML or CSS if using the CSS file available in the public/stylesheets folder or the views available in views. A lot of the server is also scaffolded out for you already. Take some time to understand what you have already and what you'll need to build.

  4. A solution can be browsed in the first commit of this repo, direct link here: https://github.com/joedotjs/secrets/tree/ca04e5a8ae65201789fd1c4e7a92f59f325b1a63. Feel free to reference this if you get stuck!

What you need to do:

  1. Fill in the model definitions for SecretModel and CommentModel in db/models.js. Both models should really only need a text column. Keep in mind that comments should reference a secret and you'll probably have to do this using either belongsTo or hasMany, or both!

  2. You should be able to build this application feature-complete with 6 routes:

    • GET /secrets

      • This route serves up all secrets in database and renders the index.html view. An extra challenge in layering in pagination (prev/next page) but it shouldn't be necessary as the template is written now.
    • GET /

      • Redirects to GET /secrets
    • POST /secrets

      • Adds a new secret to the database, then redirects to GET /secrets
    • GET /secrets/:secretId

      • Accesses a secret from the database by its ID, along with comments, and renders out secret.html
    • GET /secrets/add

      • Renders out the form to add a new secret.
    • POST /secrets/:secretId/comments

      • Adds a new comment to a secret, to be seen on the single secret route.
  3. As mentioned earlier, there is a beyond-the-basics challenge of implementing pagination for the GET /secrets route. Look at how the hrefs in index.html for Previous/Next Page links are written. Your GET /secrets should use req.query to enhance your existing query. limit, offset in your where object will be useful to you.

secrets's People

Contributors

joedotjs avatar

Stargazers

 avatar  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.