我目前正在使用单独的.graphql文件加载 GraphQL 模式,但它封装在字符串中:
schema.graphql
const schema = `
type CourseType {
_id: String!
name: String!
}
type Query {
courseType(_id: String): CourseType
courseTypes: [CourseType]!
}
`
module.exports = schema
Run Code Online (Sandbox Code Playgroud)
然后将其用于apollo-server:
index.js
const schema = `
type CourseType {
_id: String!
name: String!
}
type Query {
courseType(_id: String): CourseType
courseTypes: [CourseType]!
}
`
module.exports = schema
Run Code Online (Sandbox Code Playgroud)
有没有办法简单地加载一个看起来像这样的 .graphql ?
schema.graphql
type CourseType {
_id: String!
name: String!
}
type Query {
courseType(_id: String): CourseType
courseTypes: [CourseType]! …Run Code Online (Sandbox Code Playgroud) 我有以下段落:
<p>Random text that has <span class="font--bold">some bold text</span> and continues on...</p>
Run Code Online (Sandbox Code Playgroud)
我正在使用ChromeVox 扩展程序来确保我的网站可以访问。根据所使用字体类型的性质,我需要使用单独的<span class="font--bold">元素来使文本变为粗体。
我的问题是,当我使用 Chromevox 导航到此段落时,它将重点关注并阅读 之前的文本<span>,然后是 内的文本<span>,然后是该段落的其余部分。
结果:
<p>元素。<p>.期望的结果:
当此格式在标头标签内使用时没有问题(例如<h2><span class="font--bold">My</span> title</h2>。Chromevox 将其作为一个部分读出。
我尝试过添加role="text"并tabindex="-1"添加到该<span>元素中,但这没有用。任何帮助将不胜感激。谢谢。
我有这个$savedRequestDates日期的PHP数组():
Array ( [0] => 2018-03-29 10:56:31 [1] => 2018-03-29 10:58:09 [2] => 2018-04-12 11:28:41 [3] => 2018-04-12 13:07:25 [4] => 2018-05-09 13:08:07 )
Run Code Online (Sandbox Code Playgroud)
在同一个.php页面的底部我有这个:
<script type="text/javascript">
var sessions = new Array('<?php echo json_encode($savedRequestDates); ?>');
console.log(sessions[0]);
</script>
Run Code Online (Sandbox Code Playgroud)
的console.log(sessions[0]);回报:
["2018-03-29 10:56:31","2018-03-29 10:58:09","2018-04-12 11:28:41","2018-04-12 13:07:25","2018-05-09 13:08:07"]
Run Code Online (Sandbox Code Playgroud)
为什么JavaScript数组在0索引处变平?如果我尝试console.log(sessions);它会返回一个带有一个变量的数组,而不是5,因为php数组清楚地显示了.
我在这里错过了什么吗?
我正在尝试使用 GraphQL(Apollo 服务器)查询单个 MongoDB 文档 ( trivia),但其中一个文档字段遇到问题。
LightningRoundQuestion.answer并且PictureRoundPicture.answer应该返回一个String,并且MultipleChoiceRoundQuestion.answer应该返回一个Int。查看架构:
schema
const typeDefs = gql`
# ROOT TYPES ==================================================
type Query {
trivia(_id: String!): Trivia
}
# INTERFACES ==================================================
interface Round {
type: String!
theme: String!
pointValue: Int!
}
type LightningRound implements Round {
type: String!
theme: String!
pointValue: Int!
questions: [LightningRoundQuestion]
}
type MultipleChoiceRound implements Round {
type: String!
theme: String!
pointValue: Int!
questions: [MultipleChoiceRoundQuestion]
}
type PictureRound implements Round { …Run Code Online (Sandbox Code Playgroud) 我的 pm2 进程开始使用它们的默认生态系统文件结构:
ecosystem.config.js
module.exports = {
apps: [{
env: {
NODE_ENV: "development"
},
error_file: "./logs/error.log",
ignore_watch: ["logs", "node_modules"],
log_date_format: "YYYY-MM-DD HH:mm:ss Z",
name: "my-app",
out_file: "./logs/output.log",
script: "./server.js",
watch: true
}]
}
Run Code Online (Sandbox Code Playgroud)
我开始这个过程pm2 start ecosystem.config.js并且工作正常,应用程序在文件更改时重新加载。
但是当我用 停止进程pm2 stop ecosystem.config.js,然后用 再次启动它时pm2 start ecosystem.config.js,pm2 不会监视文件,尽管显示列watching是enabled.
再次启动进程并让 watch 工作的唯一方法是删除 pm2 进程,然后重新启动一个新进程。
我错过了制作手表stop或restart使用手表的东西吗?
谢谢。
我正在尝试导入sass部分(_variables.scss)以在主样式表(global.scss)中使用,但是我一直Error: Undefined variable.在进行sass编译。
目录结构:
app
??public
??styles
? global.css (output for sass compiling is here).
??sass
??_variables.scss
??global.scss
Run Code Online (Sandbox Code Playgroud)
_variables.scss
$font-text: 'lato', sans-serif;
Run Code Online (Sandbox Code Playgroud)
global.scss
@use '_variables';
body {
font-family: $font-text;
}
Run Code Online (Sandbox Code Playgroud)
查看Sass文档,我理解使用@use代替@import(有效),因为他们正在逐步淘汰它。
我在这里做错了什么?谢谢。
我正在尝试实施一个 GitHub 操作,该操作将我的 repo 文件在推送到 master 分支时将其 SCP 到服务器。我在 Bitbucket Pipelines 上有一个类似的设置,但现在我正在学习使用 GitHub 操作来做到这一点,我没有任何运气。
我的项目是一个简单的Node.js 应用程序,我想简单地将所有文件 scp 到服务器,然后我将运行 post-scp 脚本,以便npm i将新文件复制到服务器。只是想在我学习的时候保持简单。
我正在使用scp-files GitHub Action。这是我的文件:
name: Deploy to production
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
deploy:
name: SCP files to server
runs-on: ubuntu-latest
steps:
- name: SCP files via ssh key
uses: appleboy/scp-action@master
env:
USERNAME: ${{ secrets.USERNAME }}
HOST: ${{ secrets.HOST }}
KEY: ${{ secrets.SSH_DEPLOYMENT_KEY }}
with:
source: './*'
target: '/home/ubuntu/flatbread/' …Run Code Online (Sandbox Code Playgroud) 我正在尝试trivia使用 GraphQL查询单个 MongoDB 文档 ( ),但在使用其中一个文档字段时遇到问题。这是trivia.rounds应该返回对象的数组(无论是现场LightningRound或MultipleChoiceRound)。
schema.graphql
type Trivia {
_id: String!
createdAt: String!
rounds: [Round]!
}
interface Round {
type: String!
theme: String!
pointValue: Int!
}
type LightningRound implements Round {
type: String!
theme: String!
pointValue: Int!
questions: [LightningRoundQuestion]
}
type MultipleChoiceRound implements Round {
type: String!
theme: String!
pointValue: Int!
questions: [MultipleChoiceRoundQuestion]
}
// ...
Run Code Online (Sandbox Code Playgroud)
trivia.js // resolver
require('dotenv').config()
const { ObjectId } = require('mongodb')
const trivia = (app) => …Run Code Online (Sandbox Code Playgroud)