This file contains hidden or 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
.accordion { | |
background-color: #eee; | |
color: #444; | |
cursor: pointer; | |
padding: 18px; | |
width: 100%; | |
border: none; | |
text-align: left; | |
outline: none; | |
font-size: 15px; |
This file contains hidden or 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
//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(() => { |
This file contains hidden or 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
// 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() |
This file contains hidden or 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 {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); |
This file contains hidden or 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 * 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(); |
This file contains hidden or 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
Show hidden characters
{ | |
"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 | |
], |