Skip to content

Instantly share code, notes, and snippets.

View priyesh18's full-sized avatar
πŸ‘¨β€πŸ’»
Software Engineer at Goldman Sachs

Priyesh Patel priyesh18

πŸ‘¨β€πŸ’»
Software Engineer at Goldman Sachs
View GitHub Profile
.accordion {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
//inside create_test.js
const assert = require('assert');
const Pokemon = require('../src/pokemon'); //imports the Pokemon model.
describe('Creating documents', () => {
it('creates a pokemon', (done) => {
//assertion is not included in mocha so
//require assert which was installed along with mocha
const poke = new Pokemon({ name: 'Pickachu' });
poke.save() //takes some time and returns a promise
.then(() => {
// delete_test.js
const assert = require('assert');
const Pokemon = require('../src/pokemon');
describe('Deleting a pokemon', () => {
let poke;
beforeEach((done), () => {
poke = new Pokemon({ name: 'poke' });
poke.save()
import {Request, Response} from "express";
import pokemons = require('../db.json'); //load our local database file
export class Pokemons {
public routes(app): void { //received the express instance from app.ts file
app.route('/pokemons')
.get((req: Request, res: Response) => {
res.status(200).send(pokemons);
import * as express from 'express';
import * as bodyParser from 'body-parser'; //used to parse the form data that you pass in the request
class App {
public app: express.Application;
constructor() {
this.app = express(); //run the express instance and store in app
this.config();
@priyesh18
priyesh18 / tsconfig.json
Last active August 9, 2018 13:41
Basic TypeScript configuration
{
"compilerOptions": {
"target": "es6", //default is es5
"module": "commonjs",//CommonJs style module in output
"outDir": "dist" , //change the output directory
"resolveJsonModule": true //to import out json database
},
"include": [
"src/**/*.ts" //which kind of files to compile
],