Skip to content

neighlyd/node-task-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Task App

The Task App allows users to create accounts and track their tasks, marking them as completed. It has built-in filtering and querying for tasks. Routes are secured behind authentication and tasks are automatically filtered by user profile. The API connects to a mongoDB instance that preserves all user and task information.

A demo of the API can be reached at https://neighly-task-app.herokuapp.com/

API Documentation

The following endpoints are accessible through the API. Select each to read more about the data constraints, responses, errors, and to see examples.

Open Endpoints

Open endpoints require no authentication

Endpoints Requiring Authentication

Closed endpoints require a valid JWT Token to be included in the request header. The JWT Token can be acquired through either the [Register] or [Login] endpoints above. The JWT Token is expected in the standard form:

Authorization: Bearer <JWT Token>

User Endpoints


These endpoints affect the currently authenticated user determined by the JWT Token header using the authenticate.js middleware.

The code for these routes can be found in routes/user.js.

Task Endpoints


These endpoints show and affect the tasks for a given user. The user is determined by the JWT Token header using the authenticate.js middleware.

The code for these routes can be found in routes/task.js.

Installation

If you want to install your own version of the task app api please follow these instructions.

Requirements

The following software is required to run the task app api.

  • git
  • node
  • mongodb

Installation and Usage

To install and run locally:

$ git clone git://github.com/neighlyd/node-todo-api
$ cd node-todo-api
$ npm install
$ mkdir config
$ cd config
$ touch dev.env test.env

Your dev.env and test.env files should have the following key-value pairs within them.

#dev.env
PORT=3000
MONGODB_URI="mongodb://localhost:27017/task-app"
JWT_SECRET="Type some random stuff in here to generate a secret key for JWT"
SENDGRID_API_KEY="Your Sendgrid API key goes here"
#test.env
PORT=3000
MONGODB_URI="mongodb://localhost:27017/task-app-test"
JWT_SECRET="More random stuff in here for another JWT secret Key"
SENDGRID_API_KEY="Your Sendgrid API key again here"

If you need information on setting up a Sendgrid API key, check out this tutorial.

Finally, run:

$ npm run dev

This will launch the task app at localhost:3000/


If you wish to deploy the app remotely to heroku, I recommend viewing their Getting Started on Heroku with Node.js tutorial.

Testing

Once you have the app installed, you can test it by running the following command:

$ npm test

Feedback

If you have any feedback, suggestions, or thoughts, please feel free to drop me a line in the issues tab or by sending me an email at neighlyd at gmail.

Acknowledgements

This project grew out of Andrew Mead's excellent and informative Udemy Node class. If you are interested in learning Javascript, Node, or React, I highly recommend checking out his courses. You can find him on twitter @andrew_j_mead.

The API documentation was inspired by [@jamescooke](https://github.com/jamescooke]'s comprehensive REST API docs repository.

Another example of clear and concise REST API documentation can be found on the OpenStack project.

About

Node TODO Api for Node Udemy course

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published