You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
prerequisites: JavaScript, Node.js, some SQL helpful
@@ -23,7 +23,7 @@ courses:
23
23
24
24
I miss the days of the internet when people built cool stuff for the sake of making fun things. There were a lot of random sites that were heavily in circulation during my younger years, like [Google Doodles](https://doodles.google/search/?form_tags=interactive%20game), that embraced creativity and play. [insert an image of some examples here] Here’s a project tutorial that might help bring us back to these days — you’ll be building a website where anyone can draw a doodle for a public virtual museum exhibit!
25
25
26
-
[add an image previewing what they'll be making here]
26
+
<imgsrc="">
27
27
28
28
To make this project, we’ll be using the classic web dev tools HTML, CSS, and JavaScript, and will be storing our drawings in [Supabase](http://supabase.com/). We’ll also be using [Vite](https://vite.dev/) to get a local server running our website, that way you can run local servers with Node.js. I picked Vite because it handles imports cleanly, refreshes your website automatically with any changes, and is structured to better handle a project with a realtime database!
29
29
@@ -39,9 +39,9 @@ I’ll be using [VS Code](https://code.visualstudio.com/) for this project, but
39
39
40
40
## ## Supabase setup
41
41
42
-
1. Create a project by clicking on **New Project**.
42
+
1. Create a project by clicking on **New Project**. Name it whatever you'd like.
43
43
2. Find the Storage Menu and click on it. Then create a new bucket, and name it "drawings". Make sure this bucket is set to public so your gallery is viewable!
44
-
3. Open up the SQL Editor, and run this code:
44
+
3. Open up the SQL Editor on the lefthand menu (it pops up when you hover on it), and run this code:
45
45
46
46
```sql
47
47
createtableif not exists public.drawings (
@@ -51,10 +51,15 @@ create table if not exists public.drawings (
51
51
created_at timestamptznot null default now()
52
52
);
53
53
```
54
+
The interface should look like this:
55
+
<imgsrc="">
56
+
57
+
## ## **Adding your API Keys**
58
+
We need to add API keys to our project for it to connect to our storage bucket - API keys authenticate the usage of coding tools like Supabase.
54
59
55
60
1. Go to the API menu under Project Settings. Find your Project URL and API key. They should look something like this:
56
61
57
-
[add an example of a sample Project URL and API key so they know what format to look for]
62
+
<imgsrc="">
58
63
59
64
## ## **Clone Template**
60
65
@@ -85,12 +90,16 @@ Make sure you have the latest version of [Node.js](https://nodejs.org/en/downloa
85
90
86
91
Run this command in the terminal: `npm create vite@latest`, and then answer the prompts as follows. You can name your project however you like. When prompted, pick `Vanilla` as your framework and `JavaScript` as your variant. Your terminal should look like this at the end of completing the steps:
87
92
93
+
<imgsrc="">
94
+
88
95
This might look different depending on what kind of computer you’re using — in my case, I’m on a Macbook.
89
96
90
97
## ## Running your server
91
98
92
99
To start up a server with your webpage running, type `npm run dev` in the Terminal. It’ll give you a url that looks something like: `http://localhost:3000/` — but the numbers in the URL can vary. Copy the link and paste it in your browser, and you should see something like this:
93
100
101
+
<imgsrc="">
102
+
94
103
## ## **.env File and API Keys**
95
104
96
105
In your root folder, create a new file called `.env`. An `.env` file is used to keep sensitive information like API keys and credentials secret, and use substitute names in your code instead of the actual keys or data. This is helpful if your code is publicly shared, like on GitHub for example, since it hides the API keys automatically!
@@ -350,6 +359,8 @@ We want our big gallery to load random drawings, so everyone’s drawings have a
350
359
351
360
Then we’re going to add our batch of drawings to our marquee. If you don’t know what a marquee is, it’s a scrolling gallery, or set of text that seems to scroll infinitely!
352
361
362
+
<img src="">
363
+
353
364
We’ll write out our function header for `repeatMarquee()`, limiting the number of drawings picked to 200. Our marquee has two rows, and if neither of them render, it’ll stop the function through the `if` statement.
0 commit comments