Code Monkey home page Code Monkey logo

next-template's Introduction

Build Status Deploy to now

This project is deprecated.

This project was just an experiment on how to achieve modular architecture with Next.js and Graphql. But it's not good enough. In case you want a similar setup, just use Next.js 10 with multi-zone support.

Installation

curl https://sh.rustup.rs -sSf | sh
rustup toolchain add nightly
rustup target add wasm32-unknown-unknown --toolchain nightly

cargo install cargo-wasm
cargo wasm new <project_name>
cargo wasm build

Style guide

  • Create unique index for upserting
ALTER TABLE the_table ADD CONSTRAINT constraint_name UNIQUE (column1, column2);

Reload metadata

Generate Vapid keys

npm i -g web-push
web-push generate-vapid-keys

Filestack api key

{
  viewer {
    project(id:"1809351104c047e5be6a8e3fcc9931d2") {
        stage(name:"master") {
        assetConfig {
          apiKey
        }
      }
    }
  }
}
  • Select columns of a table
SELECT column_name
FROM information_schema.columns
WHERE table_schema = 'public'
  AND table_name   = 'table_name'
  • Timesstamp trigger
CREATE OR REPLACE FUNCTION trigger_set_timestamp()
RETURNS TRIGGER AS $$
BEGIN
  NEW.updated_at = NOW();
  RETURN NEW;
END;
$$ LANGUAGE plpgsql;

CREATE TRIGGER set_timestamp
BEFORE UPDATE ON table_name
FOR EACH ROW
EXECUTE PROCEDURE trigger_set_timestamp();

GraphQL

Only use graphql-tag to write Graphql Query.

Get all columns and datatypes, nullability of schema/table

SELECT
    "pg_attribute".attname                                                    as "column",
    pg_catalog.format_type("pg_attribute".atttypid, "pg_attribute".atttypmod) as "datatype",

    not("pg_attribute".attnotnull) AS "nullable"
FROM
    pg_catalog.pg_attribute "pg_attribute"
WHERE
    "pg_attribute".attnum > 0
    AND NOT "pg_attribute".attisdropped
    AND "pg_attribute".attrelid = (
        SELECT "pg_class".oid
        FROM pg_catalog.pg_class "pg_class"
            LEFT JOIN pg_catalog.pg_namespace "pg_namespace" ON "pg_namespace".oid = "pg_class".relnamespace
        WHERE
            "pg_namespace".nspname = 'public'
            AND "pg_class".relname = 'sche_students'
    );

next-template's People

Contributors

renovate-bot avatar revskill10 avatar trungth12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

trungth12 agdolla

next-template's Issues

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.