Live App Deployed at: https://exploretheplanets.herokuapp.com/
Interstellar explorer is an app that utilizes the MVC design pattern as well as and SQL database and express to allow the user to dynamically create objects (in this case planets) and then edit or delete them. The information entered on the app is relayed to a database and then the page is reloaded with the new information.
- Installation and Usage
- Dependencies and Code Snippet
- Languages used
- Author
- License
- Acknowledgements
This app is deployed for use via Heroku at the link located at the top of this page. It can also be run locally via node and mysql Workbench once the dependencies are installed.
This app uses the following dependencies: npm express (for routing to different pages and using GET, PUT, POST, and DELETE routes) npm mysql (for making sql queries back to the primary database) npm express-handlebars (for displaying the information via html)
Here is an example of the code utilized in this app. Ths particular code is for creating a new instance of a 'planet':
$(".create-form").on("submit", function(event) {
event.preventDefault();
let newPlanet = {
name: $("#plan").val().trim(),
size: $("#size").val().trim(),
color: $("#color").val().trim(),
gas: $("[name=gas]:checked").val().trim(),
explored: 0
};
// Send the POST request
$.ajax("/api/planets", {
type: "POST",
data: newPlanet
}).then(
function() {
console.log("Created a new planet");
// Reload the page
location.reload();
}
);
});
- Sam Poppe
This project is licensed under the MIT License
- Hat tip to my teacher Jerome Chenette and my TAS Kerwin Hy and Mahisha Gunasekaran for teaching me all the skills needed for this project.