This was the main team website created for Team Impulse - The Physics Club of The Mother's International School. It's main functionality was to register teams (with proper validation) and add them to a Google Sheets file.
This website was created using NodeJS, Express, and Pug - A template engine for NodeJS (https://pugjs.org/).
-
Install the Git CLI and clone this repository.
# clone this repository git clone https://github.com/arhaanb/teamimpulse.git
-
Install the node dependencies.
Navigate into the directory you just cloned. You need to have NodeJS installed before you proceed with this step. https://nodejs.org/en/download/
cd teamimpulse npm i
-
Open the source code and start editing!
Use your favourite code editor and start coding! Create a .env file in the root directory and fill it with the following details:
- PASSWORD
- SHEET_ID
This project is configured to work only with Gmail accounts.
-
Follow these steps to enable all functionality from the website
-
Generate API keys for Google Sheets from (https://console.developers.google.com/apis/). Create a new project and enable the Google Spreadsheet API. Download your credentials (API Keys) and store them in a
client_secret.json
file in the root directory. Also remember to share the spreadsheet you are using with the 'Service Account' that google provides, and give it edit access. Thats the email that'll be adding all submissions to your spreadsheet. -
Enable "Allow less secure apps access to your gmail account" from https://myaccount.google.com/lesssecureapps
-
-
Compile and run your code
run the following command in your terminal.
node app.js
You will find your website live on https://localhost:5000. To edit the frontend, edit files availaible in the views directory. To edit the contents of the confirmation email, edit the
email.hbs
file.Note: You will have to run this command every time you make changes to the source code. To avoid this, you can install a package called nodemon - https://www.npmjs.com/package/nodemon. This will update the browser every time you save your files automatically.
A quick look at the top-level files and directories you'll see in this project.
.
βββ node_modules
βββ public
βββ routes
βββ views
βββ .gitignore
βββ app.js
βββ Procfile
βββ package-lock.json
βββ package.json
βββ README.md
-
/node_modules
: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed. -
/views
: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. This is all coded in Pug. -
.gitignore
: This file tells git which files it should not track / not maintain a version history for. -
routes
: This folder contains routes that the user would visit and which files it will render for them. -
public
: This folder contains all files which are available publicly on the server, such as the CSS files, images, fonts, etc. -
package-lock.json
(Seepackage.json
below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. (You wonβt change this file directly). -
package.json
: A manifest file for Node.js projects, which includes things like metadata (the projectβs name, author, etc). This manifest is how npm knows which packages to install for your project. -
README.md
: A text file containing useful reference information about your project.
Every submission is stored in a Google Sheet with a randomly generated password for each team. Each team also receives a confirmation email with their team information instantly.
- / - Overview of Team Impulse
- /members - A list of members in Team Impulse with their positions
- /register - A registration page for Enigma - Team Impulse's annual online cryptic hunt. This route will show you that registrations have ended. you can access the register page at
/arhaanb
. - /arhaanb - Registration functionality here. (Ideally should have been present at
/register
but it was disabled since registrations ended.) - /enigma - Redirects to the URL where Enigma was held (https://enigma.teamimpulse.co.in).