A redo of the current internal sources website to:
- Move away from Google Sheets as our data store, and use MySQL instead
- Add Google OAuthentication for our
@media.ucla.edu
emails - Serve up a snazzy front-end
- Make the list of sources editable
- Find a folder you'd like to hold this code in.
- Navigate to it, e.g.,
cd /Users/user/Code/
- Clone this repo:
git clone https://github.com/daily-bruin/Sources-Revamp.git
Next, you'll need Node and npm to run a local server instance:
- Install Homebrew .
- Install Node.js:
brew install node
- Install npm:
brew install npm
- Install dependencies with
npm install
- By default, you can start the server with
node ./bin/www
. When in doubt, consult thestart
field inpackage.json
for the right start command.
On Linux, you can also do a native install of NodeJS from this tutorial.
For local testing:
- You may use any instance of the MySQL server. On Mac, install Homebrew and continue on to step 2. See instructions for Linux and instructions for Windows, and continue to step 3.
- Use Homebrew to install MySQL:
brew install mysql
- Start mysql with
mysql.server start
or if it's already running:mysql.server restart
- Change the password for root
- Launch the MySQL REPL as
mysql
in Bash - Create a new user
db
with passwordbruins111
:CREATE USER db
- Change the password for the new user:
update mysql.user set password=PASSWORD('bruins111') where User='db';
. (Original tutorial) - Give them privileges to the default
test
database (comes with a fresh MySQL install):GRANT ALL PRIVILEGES ON test.* TO db@localhost;
- Reload all the permissions:
flush privileges;
- Head over to
app.js
to set-up the database connection. A more detailed example can be found here
- Inside of the MySQL REPL, switch over to the
test
database:use test
- Create a new table:
CREATE TABLE sources (
name VARCHAR(60),
org VARCHAR(500),
phones VARCHAR(500),
emails VARCHAR(500),
notes VARCHAR(1000)
);
- And insert a test row:
INSERT INTO sources VALUES (
"Bob Bobsworth",
"(UCPD: Assistant Cop), (ASUCLA: Architect of Dreams, Chief Ambassador)",
"(Work: 000-000-0000), (Cell: 512-512-5121, 111-111-1111)",
"(Work: [email protected]), (Personal: [email protected])",
"Emotionally unavailable"
);