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 router = require('express').Router() | |
router.get('/', (request, response, next) => { | |
return response.status(200).json({ | |
"data": { | |
"message": "API loaded" | |
} | |
}) | |
}) |
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 session = require('express-session') | |
const mongoose = require('mongoose') | |
const logger = require('morgan') | |
const bodyParser = require('body-parser') | |
const busboy = require('connect-busboy') | |
const MongoStore = require('connect-mongo')(session) | |
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
{ | |
"name": "backend", | |
"version": "1.0.0", | |
"description": "a custom backend for a file upload website", | |
"main": "server.js", | |
"scripts": { | |
"serve": "nodemon ." | |
}, | |
"repository": { | |
"type": "git", |
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 puppeteer = require('puppeteer'); | |
const PDFDocument = require('pdfkit'); | |
const fs = require('fs'); | |
(async () => { | |
const browser = await puppeteer.launch() | |
const page = await browser.newPage() | |
await page.goto('http://localhost:8080') | |
// await page.screenshot({path: 'screenshots/example.png'}) |
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
var docx = require('./docx') // my custom file containing the other two functions | |
docx.extract('path\\to\\my\\file.docx').then(function(res, err) { | |
if (err) { | |
console.log(err) | |
} | |
console.log(res) | |
}) |
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
extract: function(filePath) { | |
return new Promise( | |
function(resolve, reject) { | |
module.exports.open(filePath).then(function (res, err) { | |
if (err) { | |
reject(err) | |
} | |
var body = '' | |
var components = res.toString().split('<w:t') |
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
open: function(filePath) { | |
return new Promise( | |
function(resolve, reject) { | |
const zip = new StreamZip({ | |
file: filePath, | |
storeEntries: true | |
}) | |
zip.on('ready', () => { | |
var chunks = [] |
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
<template> | |
<div> | |
<div> | |
<h1 style="margin-top: 5%; margin-bottom: 3%">News.</h1> | |
<div class="row"> | |
<div v-for="article in articles" class="col-md-3" style="margin-right: 5%; margin-bottom: 5%"> | |
<b-card :title="article.title" | |
:img-src="article.urlToImage" | |
img-alt="Image" | |
img-top |
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
// TO INSTALL: npm init bootstrap-vue --save | |
import Vue from 'vue' | |
import App from './App' | |
import router from './router' | |
import BootstrapVue from 'bootstrap-vue' | |
import 'bootstrap/dist/css/bootstrap.css' | |
import 'bootstrap-vue/dist/bootstrap-vue.css' | |
Vue.use(BootstrapVue) |
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 Vue from 'vue' | |
import Router from 'vue-router' | |
import Homepage from '@/components/Homepage' | |
Vue.use(Router) | |
export default new Router({ | |
routes: [ | |
{ | |
path: '/', |