This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//requires | |
var mysql = require('mysql'); | |
const express = require("express"); | |
const app = express(); | |
const { apiHost, apiPort, apiKey, mysqlSettings } = require('./config.json'); | |
//web server | |
app.listen(apiPort, apiHost, () => { | |
console.log("Application started and listening on http://" + apiHost + ":" + apiPort); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Ajax for filter (replace DOMAIN.com with your domain name) | |
$("#postFilterLinks a").click(function(e) { | |
e.preventDefault(); | |
var dataID = $(this).attr("data-id") | |
$.ajax({ | |
type: "GET", | |
url: "http://DOMAIN.com/posts-filter", | |
data: "categoryID="+dataID, | |
success: function(html) { | |
$("#postsFiltered").html(html); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getRecentForumTopics() { | |
$communityUrl = 'http://www.domain.com/'; | |
$apiKey = 'API KEY'; | |
$endpoint = '/forums/topics'; | |
$vars = '?sortDir=desc&perPage=4'; | |
$curl = curl_init( $communityUrl . 'api' . $endpoint.$vars ); | |
curl_setopt_array( $curl, array( | |
CURLOPT_RETURNTRANSFER => TRUE, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getWordpressPosts() { | |
$wordpressUrl = 'http://domain.com/'; | |
$endpoint = '/wp/v2/posts/'; | |
$vars = ''; | |
$curl = curl_init( $wordpressUrl . 'wp-json' . $endpoint.$vars ); | |
curl_setopt_array( $curl, array( | |
CURLOPT_RETURNTRANSFER => TRUE, | |
CURLOPT_HTTPAUTH => CURLAUTH_BASIC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from 'react' | |
class Sample extends Component { | |
render() { | |
const { title, description, body } = this.props | |
return ( | |
<div className="member"> | |
<h1>{title}</h1> | |
<p>{description}</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class GalleryController extends AppController { | |
public function index() { | |
$this->set('title_for_layout', 'Gallery'); | |
$this->loadModel('Gallery'); | |
$this->paginate = [ | |
'limit' => 10, | |
'order' => [ | |
'Gallery.position' => 'desc' | |
] |