Server application to simulate r/place
Go (https://go.dev/doc/install)
- Clone the repository
git clone --recurse-submodules -j8 https://github.com/rdeepak2002/reddit-place-clone-server.git
- Deploy a server application with this code (Heroku can directly deploy this Go project from a GitHub repository, but you need to add the submodules buildpack and Go buildpack)
heroku buildpacks:add https://github.com/dmathieu/heroku-buildpack-submodules -i 1
- Create a .env file with the credentials for a Redis connection (you can get a free instance from here: https://redis.com/)
REDIS_ADDRESS="redis-xxx.com:#####"
REDIS_PASSWORD="really_long_password_string"
GOOGLE_AUTH_CLIENT_ID="xxxxx.apps.googleusercontent.com"
Add pixels here: https://reddit-place-clone-server.herokuapp.com/
Then refresh the page and notice the image below changing (note that it is blurrier than the one present on the web application due to the lack of CSS styling in GitHub README's).
The above example is using the following markdown:
<img alt="image" src="https://reddit-place-clone-server.herokuapp.com/static/image.png" style="border: dotted black; width: 300px; height: 300px; image-rendering: pixelated; image-rendering: -moz-crisp-edges; image-rendering: crisp-edges;"/>
git submodule update --remote
Create a file in .git/hooks with the following content:
#!/bin/sh
echo "refreshing submodules"
git submodule update --remote
git add .
Make the script executable with the following command:
sudo chmod 777 .git/hooks/pre-commit