/beardy-website

Tiny cute website providing data to beardy-extension, and displaying information about manly organizations

Primary LanguageCSS

Beardy website

Site inspired by La Barbe, a French direct action feminist group that fights gender inequality with sarcastic humour and fake beards.

This site serves as a support and API provider to a chrome web extension. The extension purpose is to highlight companies, events or organizations dominated by men and towards which La Barbe directed its actions.

Both sites and extension are part of a personal exercise independant from La Barbe.

Website url : https://beardy-website.herokuapp.com/ Link to download the extension : https://chrome.google.com/webstore/detail/la-barbe/ajapagjhlmidjgcbcbpfiambnfdaefah

App creation

You need to have npm installed

$ npm install express-generator -g
$ express beardy-website --git -c sass

Then install dependencies:

$ cd beardy-website
$ npm install

and init repo

$ git init
$ git add .
$ git commit -m"whatever"

run the app in localhost:3000 with this command:

$ DEBUG=beardy-website:* npm start

To install and save in package.json (-S = --save)

npm install -S module_name

Database

Check mongo status

$ service mongod status

When you first store data in the database, such as by creating a collection, MongoDB creates the database. For example, the following creates both the database beardyWebsite and the collection organizations during the insert() operation:

$ mongo \\ connect to mongo shell
> show dbs \\ list all dbs
> use beardyWebsite
> db.organizations.insert( { name: "Lyon BD Festival",  website_url: "http://www.lyonbd.com/", beardy_date: "Friday, June 14, 2013"} );
> db.organizations.find().pretty()
> db.organizations.remove() // removes one document
> db.organizations.drop() // removes entire collection

Deploying to heroku

Add file Procfile, containing web: npm start

Add heroku support

$ heroku create beardy-website

and push

$ git push heroku master

Ensure that at least one instance of the app is running:

$ heroku ps:scale web=1

Now visit the app at the URL generated by its app name. As a handy shortcut, you can open the website as follows:

$ heroku open

to view logs

heroku logs --tail

You can check how many dynos are running using the ps command: $ heroku ps You can also run your app locally via $ heroku local web

To start a console : $ heroku run node

To connect to heroku server : $ heroku run bash

To exit bash : $ exit

Config vars : heroku local will automatically set up the environment based on the contents of the .env file in your local directory. Create a .env file that has the following contents: TIMES=2 To set the config var on Heroku, execute the following:

$ heroku config:set TIMES=2

View the config vars that are set using heroku config:

$ heroku config

Resources used, bookmarked (and sometimes abandoned)

Json DB

Basic app with express

Creating node app with API

Hosting nodejs - mongoDb

Cleaning app

Sexy grid plugin

Todo in case of motivation

  • serialize api data
  • find url helper
  • form to add data
  • basic authentication