Skip to content

Instantly share code, notes, and snippets.

View nazieb's full-sized avatar

Ainun Nazieb nazieb

View GitHub Profile
@nazieb
nazieb / app.js
Last active February 2, 2019 16:34
const express = require("express");
const app = express();
app.get("/hello", (req, res) => {
res.json({
message: "Hello, World",
});
});
app.post("/ping", (req, res) => {
const app = require("./app");
app.listen(process.env.PORT, () => {
console.log("App is running...");
});
const awsServerlessExpress = require("aws-serverless-express");
const app = require("./app");
const server = awsServerlessExpress.createServer(app);
exports.handler = (event, context) => {
awsServerlessExpress.proxy(server, event, context);
}
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@nazieb
nazieb / CustomXenditHttpClient.php
Last active January 18, 2021 15:20
Send Custom Header using Xendit PHP Library
<?php
class CustomXenditHttpClient implements \Xendit\HttpClientInterface
{
public function request($method, $uri, array $options = []) {
$client = new \GuzzleHttp\Client([
'headers' => ['X-API-VERSION' => '2019-02-04'],
'base_uri' => \Xendit\Xendit::$apiBase,
]);
return $client->request($method, $uri, $options);