Skip to content

The repo for part one of SwapCards coding challenge. Created using typescript,graphql(Apollo), and NodeJS

License

Notifications You must be signed in to change notification settings

SebastianKurp/SwapCard_Node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwapCard Challenge Part 1 - Node

NPM Modules and Technologies Used

  • mongoose (For schema validation)
  • apollo-server (For setting up the graphql server)
  • dotenv (For saving the mlab uri without hardcoding it)
  • graphql
  • typescript (For type checking)
  • mlab (For providing/hosting a noSQL DB)

Install and Build For Production

Clone repo to your local machine

git clone https://github.com/SebastianKurp/SwapCard_Node.git

Get the .env file and place it in the root of the project

SwapCard_Node\

Install the dependencies npm install

Run the server in dev mode

npm run dev

To build for production, you will need to compile the project first since it's typescript

npm run compile && npm run start

Complete List of Queries and Mutations to use with GraphQL Playground

query getAllTasks{ ##Query Tasks
  tasks {
    taskID
    taskName
    completed
    timestamp
  }
}

query GetTaskFromID{ ##returns specific task that matches the ID
  task(id: "5bd760e9e7179a1b53ff5504" ){ ##enter id here
    taskID
    taskName
    completed
    timestamp
  }
}

mutation AddTask( ##Add a task
  $taskID: String,
  $taskname: String,
  $completed: Boolean,
  $timestamp: String
) {
  addTask(input: {
    taskID: $taskID,
    taskName: $taskname,
    completed: $completed,
    timestamp: $timestamp
  }) {
    taskID
    taskName
    completed
    timestamp
  }
}

mutation EditTask( ##Uncheck and check the task
  $completed: Boolean,
  $timestamp: String
) {
  editTask(
    id: "5bd760e9e7179a1b53ff5504", ##enter id here
    input: {
    	completed: $completed,
    	timestamp: $timestamp
    }) {
    completed
  }
}

mutation DeleteTask ##Deletes Task
{
  deleteTask(id: "5bd760e9e7179a1b53ff5504") { ##enter id here
    taskName
  }
}

Query Variables

{
  "taskID": "1231231asdad123",
  "taskname": "Check if Code Works",
  "completed": true,
  "timestamp": "10:12 AM CST 11-19-18"
}

List of Tests

References and Guides Used

About

The repo for part one of SwapCards coding challenge. Created using typescript,graphql(Apollo), and NodeJS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published