mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-10 09:52:51 +00:00
Merge branch 'master' into golang
This commit is contained in:
@@ -7,14 +7,15 @@ import (
|
||||
|
||||
// Redirect to discord
|
||||
func DiscordRedirect(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
||||
|
||||
http.Redirect(w, r, "https://discordapp.com/invite/0Z2tzxKECEj2BHwj", 301)
|
||||
|
||||
}
|
||||
|
||||
// Redirect to discord
|
||||
func VPNRedirect(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
||||
|
||||
http.Redirect(w, r, "https://mitchel.io:943", 301)
|
||||
|
||||
}
|
||||
|
||||
// Redirect to security cameras
|
||||
func CameraRedirect(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
||||
http.Redirect(w, r, "http://24.118.44.161:8080/html/", 301)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<p>For this project you will need an ESP8266 and a DHT temperature sensor. For prototyping purposes I prefer to use the <a href="http://www.banggood.com/NodeMcu-Lua-ESP-12E-WIFI-Development-Board-p-985891.html">NodeMCU module</a>. There are a variety of temperature sensors that you could use, but I prefer the DHT11 because it is easy to use and it is cheap! I ordered a 5 pack of them from <a href="http://www.banggood.com/5Pcs-KY-015-DHT11-Temperature-Humidity-Sensor-Module-For-Arduino-p-983263.html">Banggood</a>. The source code for this project can be found on <a href="https://github.com/mgerb42/esp8266-HTTPTempSensor">Github</a>.
|
||||
<p>For this project you will need an ESP8266 and a DHT temperature sensor. For prototyping purposes I prefer to use the <a href="http://www.banggood.com/NodeMcu-Lua-ESP-12E-WIFI-Development-Board-p-985891.html">NodeMCU module</a>. There are a variety of temperature sensors that you could use, but I prefer the DHT11 because it is easy to use and it is cheap! I ordered a 5 pack of them from <a href="http://www.banggood.com/5Pcs-KY-015-DHT11-Temperature-Humidity-Sensor-Module-For-Arduino-p-983263.html">Banggood</a>. The source code for this project can be found on <a href="https://github.com/mgerb/esp8266-HTTPTempSensor">Github</a>.
|
||||
</p>
|
||||
|
||||
<h3>How it works</h3>
|
||||
@@ -46,5 +46,5 @@
|
||||
|
||||
<h2>Code</h2>
|
||||
|
||||
<script src="https://gist.github.com/mgerb42/fbed7864f8617ada797a.js"></script>
|
||||
</div>
|
||||
<script src="https://gist.github.com/mgerb/fbed7864f8617ada797a.js"></script>
|
||||
</div>
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
<p>There were a few other updates that I made. I realized that if the access point the ESP was connected to goes down, it would not try to reconnect. It will now check if it is connected to the access point every time it tries to take a temperature reading and send data. If it is not connected to the access point it will reboot. Now that it reboots, if it still cannot connect to the access point it will be stuck in config mode. I fixed this by creating a timeout. If it has been sitting in config mode for 10 minutes the device will reboot.
|
||||
</p>
|
||||
|
||||
<p>These example are show below. Keep in mind that this is not the entire program, but just the new functionality that I mentioned. The source code for the project can be found <a href="https://github.com/mgerb42/esp8266-HTTPTempSensor/tree/working">here</a>.
|
||||
<p>These example are show below. Keep in mind that this is not the entire program, but just the new functionality that I mentioned. The source code for the project can be found <a href="https://github.com/mgerb/esp8266-HTTPTempSensor/tree/working">here</a>.
|
||||
</p>
|
||||
|
||||
<script src="https://gist.github.com/mgerb42/61882e3676688bd4fb74.js"></script>
|
||||
<script src="https://gist.github.com/mgerb/61882e3676688bd4fb74.js"></script>
|
||||
|
||||
<h3>Problems flashing the ESP</h3>
|
||||
<p>I previously used the ESP-07, but recently got some new ESP-12e's because of the higher flash size. I thought this would be great if I was going to make use of the file system. After spending hours and hours trying to flash these chips, I came to the conclusion that I need a better serial to USB programmer. The current one that I use came from China and was very cheap.
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
|
||||
<ul>
|
||||
<li><a href="mailto:mgerb42@gmail.com">mgerb42@gmail.com</a></li>
|
||||
<li><a href="https://github.com/mgerb42" target="_blank">GitHub</a></li>
|
||||
<li><a href="https://github.com/mgerb" target="_blank">GitHub</a></li>
|
||||
<li><a href="https://www.linkedin.com/in/mitchell-gerber-125391b3" target="_blank">LinkedIn</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
## Converting to Go back end and Angular front end
|
||||
# Golang Site Implementation
|
||||
|
||||
I have been working on converting my entire website over to the Go programming language. Along with doing this I have also converted the front end entirely to AngularJS. MongoDB is still used and the data base queries have been more optimized.
|
||||
|
||||
I have also made this project open source. Passwords are no longer stored in the code. Rename "config-template.json" to "config.json" to start the server.
|
||||
|
||||
@@ -23,7 +23,8 @@ func Routes() *httprouter.Router {
|
||||
|
||||
r.GET("/discord", controller.DiscordRedirect)
|
||||
r.GET("/vpn", controller.VPNRedirect)
|
||||
|
||||
r.GET("/camera", controller.CameraRedirect)
|
||||
|
||||
//set up public folder path
|
||||
r.ServeFiles("/public/*filepath", http.Dir("./public"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user