andrew-icf / server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WAT

Screenshot

  • This repo is the server-side of our decoupled app.
  • The client side is live on the web here: https://watclient-3b85b.firebaseapp.com/
  • WAT is a Reddit clone geared toward providing resources for learning full-stack web development, with the MVP being focussed on JavaScript.
  • Visitors can view all the learning resources (videos, websites, books, etc.).
  • Registered users can Add resources, Comment on them, and add their favorites to a list.

Created By

  • Andrew Vandermeer
  • Andy Knolla
  • Christopher Comella
  • Steven Lawson

Key Technologies Used

Routes

OAuth:

  • /auth/github - Login user.
  • /logout - Logout user.

API:

  • Root route: api/v1
  • Endpoints:
    • /categories - Returns all categories.
    • /resources - Returns all resources.
    • /resources/:id - Returns a resource by its id.
    • /resources/categories/:category - Returns all resources in a given category.

Dependencies

  • A GitHub account
  • PostgreSQL
  • Node.js

Run Locally

  1. Create a new OAuth app on GitHub: https://github.com/settings/applications/new
  2. Enter these settings on the GitHub OAuth app settings page:
  1. Clone project and cd into project directory.
  2. Edit the .env file as per the .env.example file.
  3. Run these commands:
$ createdb wat
$ npm i
$ knex migrate:latest
$ knex seed:run
$ npm start

Then visit:
http://localhost:3000/api/v1/resources
[or any of the other API routes listed above]

Use Online

https://watserver.herokuapp.com/api/v1/resources
[or any of the other API routes listed above]

jQuery AJAX Request Code Sample

$(document).ready(function() { 
	$.ajax({   
		url: "https://watserver.herokuapp.com/api/v1/resources/categories/javascript",
		   success: function(result) {    
      // Do whatever you want with the result here, such as:
      for (var i = 0; i < result.resources.length; i++) {     
				console.log(result.resources[i])    
			}   
		}  
	});
});

About


Languages

Language:JavaScript 100.0%