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
{ | |
"cache": false, | |
"check-coverage": false, | |
"extension": [ | |
".ts" | |
], | |
"include": [ | |
"**/*.js", | |
"**/*.ts" | |
], |
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 { expect } from 'chai'; | |
import { bar, barAsync } from '../src/foo'; | |
describe('bar', () => { | |
it('sync function returns true', () => { | |
const result = bar(); | |
expect(result).to.be.true; | |
}); | |
it('async function returns true', async () => { |
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
export function bar() { | |
if (true) { | |
return true; | |
} else { | |
return false; | |
} | |
} | |
export async function barAsync() { | |
return new Promise((resolve, reject) => { |
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
Show hidden characters
{ | |
"compilerOptions": { | |
"module": "commonjs", | |
"sourceMap": true, | |
"target": "es2015" | |
} | |
} |
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
{ | |
"name": "sample", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", |
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
worker_processes auto; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay on; |
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
const express = require('express'); | |
const helmet = require('helmet'); | |
const { MongoClient, ObjectID } = require('mongodb'); | |
const url = process.env.MONGO_URL || 'mongodb://localhost:27017/twtsnt'; | |
const dbName = 'twtsnt'; | |
let client = null; | |
const port = process.env.PORT || 3000; | |
const app = express(); |
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
const { MongoClient } = require('mongodb'); | |
const axios = require('axios'); | |
const createStream = require('./tweetCrawler'); | |
// Either take the MongoDB connection string from envrionment variable MONGODB_URL or the local mongodb 'twtsnt' | |
const url = process.env.MONGO_URL || 'mongodb://localhost:27017/twtsnt'; | |
const dbName = 'twtsnt'; | |
// Create a MongoDB client instance | |
const client = new MongoClient(url, { useNewUrlParser: 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
const Twit = require('twit'); | |
const Sentiment = require('sentiment'); | |
// Create a sentiment instance | |
const sentiment = new Sentiment(); | |
// Create a Twit instance | |
const T = new Twit({ | |
consumer_key: 'consumer key obtained from twitter developer', // Twitter Developer - https://developer.twitter.com | |
consumer_secret: 'consumer secret obtained from twitter developer', |
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
{ | |
"name": "tweet-sentiment", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"start": "node index.js" | |
}, | |
"keywords": [], | |
"author": "", |