Makers Academy - Week 4 Pair Programming Project
Outline | Task | Installation Instructions | Domain Model | User Stories | Feature Tests | Objects & Methods |
This week, we're building a web app that stores web bookmarks in a database.
We're going to build a bookmark manager. A bookmark manager is a website to maintain a collection of bookmarks (URLs). You can use it to save a webpage you found useful. You can add tags to the webpages you saved to find them later. You can browse bookmarks other users have added. You can comment on the bookmarks.
Clone the repository from github then change directory into it. Run bundle then rackup to initialise the server:
$ git clone [email protected]:BenSheridanEdwards/Bookmark_Manager.git
$ cd Bookmark_Manager
$ bundle
$ rackup -p 4567
To view your bookmarks, navigate to: localhost:4567/bookmarks after you've ran rackup
$ rspec
$ rubocop
$ brew install postgresql
Alternatively, you can download the PostgreSQL app, here.
When you have PostgreSQL installed, you can start it and keep it running in the background with the command:
$ brew services start postgresql
When you're ready to start interacting with your database, you can use PostgreSQl's built-in interface (psql), a command-line tool to start using SQL, PostgreSQL's lanaguage.
To get started with your first database, i'm quickly going to show you how to create your database in the steps below:
$ psql postgres
Typing psql postgres instead of psql DATABASE_NAME will give us the access to create our first database
postgres=# CREATE DATABASE "your_user_name_here";
This will usually be the same name as your computer
yourusername=# CREATE DATABASE bookmark_manager;
This will create your bookmark manager database
yourusername=# \c bookmark_manager;
This will connect you to your newly created database
To setup the table structure for your bookmark manager, run psql after you've connected to your new database. Then run the SQL scripts in the db/migrations folder in the given order:
bookmark_manager=# psql
CREATE TABLE bookmarks(id SERIAL PRIMARY KEY, url VARCHAR(60));
bookmark_manager=# \dt
SELECT * FROM bookmarks;
You'll find all the commands to create databases and tables, as well as select, add, update, delete your tables, here.
As a user of the bookmark manager,
so I can access websites I go to regularly,
I would like to view all my bookmarks,
As a time-pressed user
So that I can save a website
I would like to add the site's address and title to bookmark manager
As a user
So I can store bookmark data for later retrieval
I want to add a bookmark to Bookmark Manager