Code Monkey home page Code Monkey logo

mutt-match's Introduction

mutt-match

find hot local mutts in your area

General tech stack:

Node for back-end, mysql for database, Angular 1 for front-end. Extras:

  • Dropbox API
  • Auth0
  • Gulp for auto-builds
  • Docker-compose with postgres db on aws swarm

Repo use:

Clean, migrate and seed database named "mutt_match":

gulp build

** note: this fails sometimes when osx messes with the linux carriage return character, or if for some reason your computer defualts restricting access to bash scripts. edit in vim and run ":set fileformat=unix" for the first, and chmod +x ./bin/build.sh should take care of the second

Start server:

gulp

Add images to dropbox:

node uploadToDropbox.js

** note: sometimes throws error and only adds some in folder, have to check with findAllLinks to see

Database setup:

Follows: https://scotch.io/tutorials/creating-an-angularjs-application-with-sequelize-part-1

  1. Install dependencies:
npm install --save sequelize sequelize-cli mysql2
npm install -g sequelize-cli
  1. Make a .sequelizerc file:
var path = require('path');

module.exports = {
  'config': path.resolve('./', 'config/config.js'),
  'migrations-path': path.resolve('./', 'server/migrations'),
  'seeders-path': path.resolve('./', 'server/seeders'),
  'models-path': path.resolve('./', 'server/models')
};
  1. Initialize sequelize folders:
sequelize init
  1. Modify the config file so it is exporting the data (add module.exports = {})
  2. Modify the config file to match the name of your database
  3. Make your database (make sure mysql server is running beforehand, otherwise you will get an error when logging in as root):
mysql -u root -p;
CREATE DATABASE your_database_name;
# show databases;
# show tables; (after you make your tables)
  1. Make your tables. Change the table name and attributes to fit your model. Can add foreign keys and relatioships manually in your code afterwards.
sequelize model:create --name=TABLENAME --attributes name:string,bio:text,count:integer --underscored
  1. "Migrate" (connect/create tables) your database
sequelize db:migrate
  1. Test your connection in your main server file (server.js or index.js)
var models = require('./server/models/');
models.sequelize
  .authenticate()
  .then(function () {
    console.log('Connection successful');
  })
  .catch(function(error) {
    console.log("Error creating connection:", error);
  });
  1. Check your database tables in the mysql terminal, and run server to verify the connection.

Deployment

If you want to play around with deployment, the stack is up on an AWS swarm managed by docker cloud, and built with the docker-compose.yml file.

mutt-match's People

Contributors

abalogun avatar max-hoffman avatar nathan-dunn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.