GithubHelp home page GithubHelp logo

nsitu / meowbase Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 6.53 MB

A social platform for cats. PHP, MySQL, VueJS and Bootstrap.

Home Page: meow-base.vercel.app

PHP 94.55% CSS 4.58% Nix 0.82% Shell 0.04%

meowbase's Introduction

Week 13 - MeowBase with Paw Button (Like) and Cat-specific meow feed.

This week's iteration of MeowBase adds a "Paw" / like button for cats. In addition, we can now view the meows of a particular cat by visiting their page. To start, create a new database in CPanel and connect your Replit via Secrets / environment variables (see also /classes/App.php )

Database Schema

A "Paw" table has been added to our Database. It is related (via Foreign Keys / Primary Keys) to the User and Meow tables. See the /migrations/setup.sql for an updated structure. You'll need to run /setup to get the structure initialized. (just append /setup to your public replit URL).

Performance and Caching

Previously the Model class would query on every page load to discover the structure and relationships in the database. Due to settings on Phoenix, These queries were quite laggy! To speed things up, information about the structure and relationships is now cached to a JSON file: /cache/schema.json. The initial caching takes a second, so you'll notice that the /setup takes a bit longer than before. Subsequent page loads, however, run more quickly.

Meows and Paws

Take a look at the updated /partials/meows.php where a Paw button has been added. The code has been refactored to be more DRY (i.e. don't repeat yourself). Some logic has been added to ensure an optimal user experience.

Meows by a particular Cat

The meow feed is now included in two places: first on the dashboard as before, but now additionally on the page of each particular cat. Notice that /views/cat.php and /views/dashboard.php now both include /partials/meows.php.

A Logging mechanism.

It's helpful to do some basic profiling, to test how long things take. In connection with this look for the log() and logDump() functions in /classes/App.php.

meowbase's People

Contributors

meowshadow avatar nsitu avatar

Watchers

 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.