Skip to content

Instantly share code, notes, and snippets.

View ashishkumarsinghh's full-sized avatar

Ashish Kumar Singh ashishkumarsinghh

  • Samsung
  • Delhi, India
View GitHub Profile
@ashishkumarsinghh
ashishkumarsinghh / PureFunction.java
Created July 17, 2018 16:44
A simple example of Pure Function
private int sum (int a , int b){
return a + b;
}
package SelfPractice;
public class SLLNode{
int data;
SLLNode next;
SLLNode(int data){
this.data = data;
this.next = null;
}
@ashishkumarsinghh
ashishkumarsinghh / routes.js
Created November 12, 2018 06:37
Handling GET/POST requests in Hapi.js
const expModel = require("./dbsetup");
const routes = [
{
method: "GET",
path: "/api/",
handler: (req, res) => {
return `Hello There !`;
}
},
@ashishkumarsinghh
ashishkumarsinghh / dbsetup.js
Created November 12, 2018 06:38
MongoDB setup with Hapi.js
const mongoose = require("mongoose");
mongoose.connect(
`mongodb://localhost/experiences`,
{ useNewUrlParser: true }
);
const expSchema = mongoose.Schema({
title: String,
description: String,