I decided to combine a couple projects I have started recently to make a complete website. The website is quite simple as there are no databases or post requests on it, but it does run off of a node js server, and combines several aspects. I added in some more methods by using the swig templates. They are quite easy to use to send information into a template.
I will be making some css changes to all of this before I make it go live, but the current code is up in a github repository. It was mostly just combining work from my last two website generation posts, but now I have an interactive site!
res.render('index',{
word1: word1,
word2: word2,
pichtml: pichtml
});
That is the main command to interact with my html to load the file based on the random word generation. I also added in a clause to make sure we receive an image from shutterstock so that the server doesn't crash. The button in my html now reloads the page rather than calling a function.
<div id="buttonform">
<form>
<input type="button" onClick="history.go(0)" value="Make a new Site">
</form>
</div>
The next goal is to run this so someone can actually use it.