- Edit your shells .rc file (for example .bashcs or .zshrc) adding the following lines.
export DATABASE_NAME="name of database" export DATABASE_USER="your database user name" export DATABASE_PASSWORD="your database password" export DATABASE_HOST="your databases host"
- Source your shell rc file
source .bashrc #For example
- Download the repo
git clone git@github.com:zermish/Character_Vault.git - cd to the project directory and install dependencies
cd Character_Vault npm install - Run the server with local forever module
./node_modules/forever/bin/forever start server.js {port number goes here}
- Create a {page name}.handlebars template in the views directory following handlebars conventions.
Example Handlebars Template:
<!-- params is a js object pased into a GET request response --> <!-- title is a key in the object --> <!-- {{}} is used to evaluate expressions and return thier resuts as html --> <h2>{{params.title}}</h2> <div> <p>This is some normal html</p> <!-- For each element in data, where data is a js object or array --> {{#each data}} <!-- create a span and evaluat the current element of data --> <span>{{this}}</span> {{/each}} </div>
- Add the page to the page_config.json file in the routes folder.
The page_config file is used to set which paths are valid and special parameters those paths are expecting.
In order to add a page to the file, create a new json object at the end of the list whos key matched the pages name exactly.
For example: if you made the page foo.handlebars the key should be “foo”:{}.
Once added to the page_config file, the page will then be accessible from the path “/{page name}.
Inside the page object, parameters can be set that will be specific to the page, like:
"foo":{ "title":"The Foobar page!", "id":23 }
- Note: All pages, other then the home page, will be passed 2 objects and an array automatically: paths (array of path names), params (object containing your specific page parameters defined earlier), and data (an object containing data to be displayed)
- Your database should be pre-populated with sample data.
- Your database should have at least 4 entities and at least 4 relationships, one of which must be a many-to-many relationship.
- It should be possible to INSERT entries into every table individually.
- Every table should be used in at least one SELECT query. For the SELECT queries, it is fine to just display the content of the tables, but your website needs to also have the ability to search using text or filter using a dynamically populated list of properties. This search/filter functionality should be present for at least one entity. It is generally not appropriate to have only a single query that joins all tables and displays them.
- You need to include one DELETE and one UPDATE function in your website, for any one of the entities. In addition, it should be possible to add and remove things from at least one many-to-many relationship and it should be possible to add things to all relationships. This means you need INSERT functionality for all relationships as well as entities. And DELETE for at least one many-to-many relationship.
- In a one-to-many relationship (like bsg_people to bsg_planets), you should be able to set the homeworld value to NULL (such as on a person in bsg_people). That removes the relationship. In case none of the one-to-many relationships in your database has partial participation, you would need to change that to make sure they can have NULL values.
- In a many-to-many relationship, to remove a relationship one would need to delete a row from a table. That would be the case with bsg_people and bsg_certifications. One should be able to add and remove certifications for a person without deleting either bsg_people rows or bsg_certification rows. If you implement DELETE functionality on at least (1) many-to-many relationship table, such that the rows in the relevant entity tables are not impacted, that is sufficient.