Git Product home page Git Product logo

sinatra-messages's Introduction

Sinatra Messages

We're going to be build a simple messaging system using Sinatra. We'll be writing out a POST request and handling the data posted to display it in an ERB file.

Instructions

  1. The contents of bin/post_message.rb must submit a POST request to localhost:9292. It should post the to, from, and content variables along with the request. Lookup how to submit POST requests using net/http and how to submit data along with that request.

  2. You will have to have 2 terminal windows open: one for the server to be running (via running rackup) and one for running the binary bin/post_message.rb. Remember to run ruby bin/post_message.rb.

  3. We want to persist the data collected from the POST request, so edit the migration. To migrate to the database, check out the Rakefile which defines some helpful tasks.

  4. Build out the post '/' route in app.rb to take the incoming data and create a message that persists to the database.

  5. Edit views/messages.erb to iterate through all the @messages and display the data.

  6. When you visit the '/' route via the get request, you should see your message!

There are no tests. Just make it work.

sinatra-messages's People

Contributors

ahimmelstoss avatar kthffmn avatar octosteve avatar fislabstest avatar aviflombaum avatar fs-lms-test-bot avatar deniznida avatar irmiller22 avatar loganhasson avatar roseweixel avatar babyshoes avatar changamanda avatar

Watchers

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