技术控

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

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

[复制链接]
西瓜荡秋千 发表于 昨天 07:09
6 4

立即注册CoLaBug.com会员,免费获得投稿人的专业资料,享用更多功能,玩转个人品牌!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
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 发表于 昨天 08:30
医生叫我进行光合作用,不要熬夜了。
回复 支持 反对

使用道具 举报

德小隆 发表于 昨天 11:30
支持楼主,拥护楼主,楼主英明呀!!!
回复 支持 反对

使用道具 举报

倒萨大威德 发表于 昨天 16:35
终于看完了,很不错!
回复 支持 反对

使用道具 举报

wx_qtX9bXxx 发表于 3 小时前
我们都知道恶虎架不住群狼。说明:”团队很重要!”
回复 支持 反对

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

我要投稿

推荐阅读

扫码访问 @iTTTTT瑞翔 的微博
回页顶回复上一篇下一篇回列表手机版
手机版/CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 )|网站地图 酷辣虫

© 2001-2016 Comsenz Inc. Design: Dean. DiscuzFans.

返回顶部 返回列表