A GraphQL-based Web App written with React, Go and MongoDB. A good starting point if you wa...

栏目: IT技术 · 发布时间: 6年前

内容简介:A web application that allows to query programmers with their skills via aYou need to have

SKMZ

A web application that allows to query programmers with their skills via a GraphQL API. The application is implemented with Go and gqlgen on the backend side and React on the front end side. MongoDB is used as a database.

A GraphQL-based Web App written with React, Go and MongoDB. A good starting point if you wa...

System requirements

You need to have Docker and Docker Compose installed in oder to build and run the project. No additional tools required.

How to build and run in production mode

Perform

docker-compose up

Access the application via http://localhost:8080 . Access the GraphQL Playground using http://localhost:8080/playground .

How to develop locally

Tools

In order to develop the app locally the following tools are required: Docker , Docker Compose (if you are on Mac or Windows it comes installed with Docker), Node.js and Go .

Verify if your environment is ready by running the following 4 commands:

docker --version
docker-compose --version
npm --version
go version

Start the dev DB

docker-compose -f docker-compose-dev.yml up

This will start a local MongoDB which will be accessible on port 27017 . The DB will be populated with test records from mongo.init .

Start the server

Navigate to the /server folder and execute:

go run server.go

This will compile and run the back end part. As a result, the API and the GraphQL playground will be available.

Start the Front End dev server

Navigate to the /webapp folder and execute the following commands:

npm install
npm start

As a result, the web site will be accessible on http://localhost:3000 .

The changes on the front end side will be automatically applied once a file is saved. The changes in the back end code require restarting the back end.

Customizations

The database starts with a preloaded set of data which can be customized in the mongo.init file .

Here is an example of a GraphQL query which can be run in the Playground :

query {
  programmers(skill: "go") { 
    name,
    picture,
    title,
    company,
    skills {
      name,
      icon,
      importance
    }
  }
}

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

大数据时代的IT架构设计

大数据时代的IT架构设计

IT架构设计研究组 / 电子工业出版社 / 2014-4 / 49.00元

《大数据时代的IT架构设计》以大数据时代为背景,邀请著名企业中的一线架构师,结合工作中的实际案例展开与架构相关的讨论。《大数据时代的IT架构设计》作者来自互联网、教育、传统行业等领域,分享的案例极其实用,代表了该领域较先进的架构。无论你就职于哪一行业都可以从本书中找到相关的架构经验,对您在今后的架构设计工作中都能起到很好的帮助作用。 《大数据时代的IT架构设计》适合具备一定架构基础和架构经验......一起来看看 《大数据时代的IT架构设计》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具