技术控

    今日:350| 主题:58231
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] GraphQL Starter Kit /w Node.js, Babel, Flow and PostgreSQL

[复制链接]
西瓜荡秋千 投递于 2016-12-2 07:09:10
146 7
GraphQL Starter Kit      

  Project template for authoring          GraphQL    server applications with    Node.js 6+and    JavaScript(          demo    ). You can use it either as a playground or a base for your next Node.js-based backend project.  
  Directory Layout

  1. .
  2. ├── /build/                     # The compiled output (via Babel)
  3. ├── /migrations/                # Database schema migrations
  4. ├── /node_modules/              # Project dependencies (npm modules)
  5. ├── /scripts/                   # Build automation scripts
  6. ├── /src/                       # Node.js application source files
  7. │   ├──/types/                  # GraphQL types /w resolve functions
  8. │   │   ├── /User.js            # User account (id, email, etc.)
  9. │   │   ├── /Viewer.js          # The top-level GraphQL object type
  10. │   │   └── /...                # etc.
  11. │   ├── /app.js                 # Express application
  12. │   ├── /config.js              # Application settings
  13. │   ├── /schema.js              # GraphQL schema
  14. │   └── /server.js              # Node.js server (entry point)
  15. ├── /test/                      # Unit, integration and load tests
  16. ├── package.json                # The list of project dependencies
  17. └── yarn.lock                   # Fixed versions of all the dependencies
复制代码
Prerequisites

  
       
  • OS X, Windows or Linux   
  •       Node.jsv6 or newer +      Yarnpackage manager   
  •       PostgreSQLv9.5 or newer (see      how to install PostgreSQL on a dev machine)   
  • Text editor or IDE (e.g.      VS Code,      WebStormetc.)  
  Getting Started

  Just clone the repo and start hacking:
  1. git clone -o graphql-starter-kit -b master --single-branch \
  2.    https://github.com/kriasoft/graphql-starter-kit.git api.example.com
  3. cd api.example.com
  4. yarn install                    # Install project dependencies. Alternatively, npm install
  5. npm run db:create               # Create a new database (see src/config.js/databaseUrl)
  6. npm run db:migrate              # Migrate database schema to the latest version
  7. npm run start                   # Launch the app. Alternatively, node scripts/start.js
复制代码
The GraphQL server should become available at    http://localhost:5000/(    live demo).  
  If you just need to build the project without launching a dev server, run one of these two commands:
  1. npm run build                   # Compiles the app into the /build folder
  2. npm run build:watch             # Compiles the app and starts watching for changes
复制代码
Database

  The following scripts can be used to transfer your existing database into another state and vise versa. Those state transitions are saved in migration files (    /migrations/*.js), which describe the way how to get to the new state and how to revert the changes in order to get back to the old state.  
  1. npm run db:create               # Create a new database
  2. npm run db:drop                 # Drop the database
  3. npm run db:version              # Print database schema version
  4. npm run db:migrate              # Migrate database schema to the latest version
  5. npm run db:migrate:undo         # Rollback the latest migration
  6. npm run db:migration <name>     # Create a new migration from the template (see /migrations folder)
  7. npm run db:seed                 # Import reference data
复制代码
Testing

  1. npm run lint                    # Find problematic patterns in code
  2. npm run check                   # Check source code for type errors
  3. npm run test                    # Run unit tests once
  4. npm run test:watch              # Run unit tests in watch mode
复制代码
Debugging

  1. # Option 1:
  2. npm run build && node build/server.js --debug --nolazy
  3. # Option 2:
  4. npm run start -- --debug --nolazy
复制代码
After launching the app in a debug mode    attach your debuggerto the process listening on    127.0.0.1:5858.  
  Contributing

  Anyone and everyone is welcome tocontribute. Start by checking out the list ofopen issues markedhelp wanted. However, if you decide to get involved, please take a moment to review theguidelines:  
  
       
  •       Bug reports   
  •       Feature requests   
  •       Pull requests  
  Related Projects

  
       
  • GraphQL.js — The JavaScript reference implementation for      GraphQL   
  • React Starter Kit — Isomorphic web app boilerplate (React, Node.js, Babel, Webpack, CSS Modules)   
  •       React Static Boilerplate— Single-page application (SPA) starter kit (React, Redux, Webpack, Firebase)   
  • Membership Database — SQL schema boilerplate for user accounts, profiles, roles, and auth claims  
  Support

  
       
  •       #react-starter-kiton Stack Overflow — Questions and answers   
  •       #react-starter-kiton Gitter — Watch announcements, share ideas and feedback   
  • GitHub Issues — Check open issues, send feature requests   
  •       @koistyaon      Codementoror      HackHands— Private consulting  
  License

  Copyright © 2016-present Kriasoft, LLC. This source code is licensed under the MIT license found in theLICENSE.txt file. The documentation to the project is licensed under the    CC BY-SA 4.0license.  
  Made with ♥ by Konstantin Tarkus (    @koistya) andcontributors



上一篇:Let’s stop copying C
下一篇:How Developers Are Responding to Ethereum&#x27;s Unexpected Fork
qinzhewei 投递于 2016-12-2 08:30:06
医生叫我进行光合作用,不要熬夜了。
回复 支持 反对

使用道具 举报

德小隆 投递于 2016-12-2 11:30:12
支持楼主,拥护楼主,楼主英明呀!!!
回复 支持 反对

使用道具 举报

倒萨大威德 投递于 2016-12-2 16:35:27
终于看完了,很不错!
回复 支持 反对

使用道具 举报

wx_qtX9bXxx 投递于 2016-12-3 04:46:17
我们都知道恶虎架不住群狼。说明:”团队很重要!”
回复 支持 反对

使用道具 举报

袁岳 投递于 2016-12-4 04:07:02
出来混,老婆迟早是要换的.
回复 支持 反对

使用道具 举报

理副将 投递于 2016-12-8 23:21:27
打酱油的人拉,回复下赚取积分
回复 支持 反对

使用道具 举报

昆仑之巅 投递于 2016-12-8 23:51:31
星期四过得很不爽!
回复 支持 反对

使用道具 举报

我要投稿

回页顶回复上一篇下一篇回列表
手机版/CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 | 粤公网安备 44010402000842号 )

© 2001-2017 Comsenz Inc.

返回顶部 返回列表