GithubHelp home page GithubHelp logo

gothinkster / node-express-prisma-v1-official-app Goto Github PK

View Code? Open in Web Editor NEW
150.0 5.0 53.0 794 KB

Official real world application built with Node + Express + Typescript + Prisma

Home Page: node-express-prisma-v1-official-app-one.vercel.app

License: MIT License

Shell 0.12% JavaScript 0.29% TypeScript 99.59%
realworld typescript nodejs express prisma hacktoberfest

node-express-prisma-v1-official-app's Introduction

Rails Example App

Official NodeJS codebase that adheres to the RealWorld API spec.

This repo is functionality complete.

Deploy to Heroku

Deploy

Getting started

Clone the repository

run git clone https://github.com/gothinkster/node-express-prisma-v1-official-app.git

Install the dependancies

NodeJS is required

cd node-express-prisma-v1-official-app
npm install

Download pgAdmin for PostgreSQL

PostgreSQL downloads page

Create a server

run pgAdmin
create a server (Object/Create/Server)
required fields:

  • name
  • HOST name/address

Connect the created server

create a .env file at the root of the project
populate it with the url of your database

DATABASE_URL="postgresql://<username>:<password>@<host_name>:<port>/<database_name>?schema=public"

Run the project locally

run npm run dev

Advanced usage

Prisma

Format the Prisma schema

npm run prisma:format

Migrate the SQL schema

prisma migrate dev --name added_job_title

Update the Prisma Client

npm run prisma:generate

with watch option

npm run prisma:generate:watch

Seed the database

npm run prisma:seed

Launch Prisma Studio

npm run prisma:studio

Reset the database

  • Drop the database
  • Create a new database
  • Apply migrations
  • Seed the database with data
npm run prisma:reset

node-express-prisma-v1-official-app's People

Contributors

geromegrignon avatar noel-johnson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

node-express-prisma-v1-official-app's Issues

it take too many effert to run prisma seed for a fresh frontend developer

at the branch "feat/fake-data", file:"prisma/seed.ts"

it take too many effert to run prisma seed for a fresh frontend developer.

There are several problems when run seed:

  • 1 no error output when seed throw
  • 2 the sql uniqe thing error; i write a
    method to fix handleUniqProp(prefix: string, propName: string, factory: () => any) ;
  • 3 the tag name uniqe thing error; i can't figureout what the ruler how tag name keep unique. so comment it

and there's another problem not friendly to fresh front coders:

  • it's a so many years project. if at the readme.md file give some guide about how to ran this project that will be wondeful. guide like run branch "feat/fake-data" with node version v16; run branch main with node version v14(the first time i run this with node@v18, no error out put , sql connected peaseful, but response error when call the api, and no match message through search engine ๐Ÿ˜ฑ )

seed copy.txt

[Feature Request] Add a Deploy to Heroku Button

Description

Add a Deploy to Herokubutton in the README.md file of the main branch to allow everyone to host their own API on Heroku with a single click (and a Heroku account)

Contribution

Please ask for an assignment if you want to work on it.
Once assigned feel free to ask questions here if you need support.

PRs from people not being assigned won't be accepted to avoid duplicate effort.

App.json

Install app.json to initialize and validate the config file

npm install app.json --global

Initialize the config file

// created at the root of the project
app.json init

Populate the config file

Expected info (guidelines):

env :
=> called JWT_SECRET
=> the description should be "A secret key for verifying authenticated users"
=> the generator model should be "secret"

addons:
=> include heroku-postgresql one

Validate the config file format

app.json validate

Add the button in the README

Add the following button before the Getting started title in the README

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)

Submit a PR

Submit a PR to the main branch

POST https://api.realworld.io/api/articles: following field is missing in author field

following is missing, and favoritedBy/_count are unnecessary.

now:

{
    "article": {
        "slug": "aaaaaaa-7595",
        "title": "aaaaaaa",
        "description": "a",
        "body": "a",
        "createdAt": "2022-01-07T12:17:47.977Z",
        "updatedAt": "2022-01-07T12:17:47.977Z",
        "tagList": [
            "bb",
            "dd",
            "a",
            "cc"
        ],
        "author": {
            "username": "jetli999",
            "bio": null,
            "image": "https://api.realworld.io/images/smiley-cyrus.jpeg"
        },
        "favoritedBy": [],
        "_count": {
            "favoritedBy": 0
        },
        "favoritesCount": 0,
        "favorited": false
    }
}

expected:

{
    "article": {
            "slug": "aaaaaaa-7595",
            "title": "aaaaaaa",
            "description": "a",
            "body": "a",
            "createdAt": "2022-01-07T12:17:47.977Z",
            "updatedAt": "2022-01-07T12:17:47.977Z",
            "tagList": [
                "bb",
                "dd",
                "a",
                "cc"
            ],
            "author": {
                "username": "jetli999",
                "bio": null,
                "image": "https://api.realworld.io/images/smiley-cyrus.jpeg",
                "following": false
            },
            "favoritesCount": 0,
            "favorited": false
        }
}

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.