Git Product home page Git Product logo

be-news's Introduction

Setup

1. Create .env.* files

  • Create ./.env.development file
    • Add config PGDATABASE=database_name with your database_name
  • Create ./.env.test file
    • Add config PGDATABASE=test_database_name with your test_database_name

2. Create SQL file

  • Create ./src/db/setup.sql using this template where you need to set your database_name and test_database_name
    DROP DATABASE IF EXISTS test_database_name;
    DROP DATABASE IF EXISTS database_name;

    CREATE DATABASE test_database_name;
    CREATE DATABASE database_name;

3. Run npm install

4. Setup databases

  • npm run setup-dbs

5. Seed DB

  • npm run seed



Contracts

Api

  • Server should return errors wrapped in error object. Example { error: { status: 404, msg: '404 Not Found' } }
  • Server should return data wrapped in named object. Example { topics: [ { description: 'The man, the Mitch, the legend', slug: 'mitch' }, ... ] }



Tests style guide



Style guide

(Example: https://google.github.io/styleguide/jsguide.html)

SQL

  • Avoid SELECT * FROM topics; use SELECT slug, description FROM topics;
    • Reasons:
      • Maintenance Issues:
        • Schema Changes: If the table schema changes, your application might break.
        • Model Compatibility: If you’re using an ORM (Object-Relational Mapping), changes to the table structure can impact your models.
      • Security Risks:
        • Sensitive Data: If new sensitive columns are added, they’ll be included.

be-news's People

Contributors

anthonymedina avatar serhii-fsi avatar nc-paul-rogerson avatar p-copley avatar daviidbartlett avatar dav3rid avatar anatdean avatar alexander-cox avatar sssam-c avatar tomosim avatar bainesface avatar callumu21 avatar jimstev2447 avatar isabelmaccabee avatar antariess avatar douglashellowell avatar dentednerd avatar itskatherine avatar liam310 avatar rogersop avatar corkesw avatar elijaharley avatar nicola-20 avatar two-triangles 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.