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
<template> | |
<section class="container"> | |
<h1> | |
<a | |
href="https://medium.com/@johnryancottam/running-nuxt-in-parallel-with-express-ffbd1feef83c" | |
target="_blank" | |
>Running NUXT in parallel with Express</a | |
> | |
</h1> | |
<div v-if="movie" class="movie"> |
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
// OMDb API endpoint | |
const axios = require('axios') | |
let movieIndex = 0 | |
app.get('/api/next-movie', async (req, res, next) => { | |
const movieOptions = [ | |
'tt3896198', | |
'tt0071253', | |
'tt0109686', | |
'tt2267998', | |
'tt0109040', |
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
describe('Mobile (iPhone 6)', function() { | |
beforeEach(function() { | |
cy.viewport('iphone-6') | |
cy.visit('/') | |
}) | |
it('Grid is Responsive, Expect 1 Movie per row', function() { | |
cy.get('.movie-item') | |
.should('be.visible') | |
.and('have.css', 'flex-basis', '100%') |
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
describe('Application UI', function() { | |
beforeEach(function() { | |
cy.visit('/') | |
}) | |
it('Verify Application Installation', function() { | |
cy.get('[data-cy=header]').should('contain', 'Testing with Cypress.io') | |
}) | |
it('Verify Movie Grid Populates w/ 10 Movies', function() { |
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
describe('OMDB API', function() { | |
it('Verify OMDB API is Functioning', function() { | |
cy.request('https://www.omdbapi.com/?i=tt3896198&apikey=9733f1df') | |
}) | |
}) |
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
<div class="item-container"> | |
<div class="image-container"> | |
<!-- low-quality placeholder --> | |
<img class="low-quality" src="//res.cloudinary.com/demo/image/fetch/e_blur:1000/e_grayscale,w_400,h_400,q_auto:low/https://unsplash.it/400/400"> | |
<!-- high-quality image --> | |
<img class="high-quality" src="//unsplash.it/400/400"> | |
</div> | |
</div> | |
<style> |
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
<div class="image-container"> | |
<img class="low-quality" src="url-to-low-quality-image.jpg"> | |
<img class="high-quality" src="url-to-high-quality-image.jpg"> | |
</div> | |
<style> | |
.image-container{ | |
position:relative; | |
width:300px; | |
height:auto; |
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
app.post('/upload', (req, res, next) => { | |
const upload = multer({ storage }).single('name-of-input-key') | |
upload(req, res, function(err) { | |
if (err) { | |
return res.send(err) | |
} | |
console.log('file uploaded to server') | |
console.log(req.file) | |
// SEND FILE TO CLOUDINARY |
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
// INDEX.JS | |
const express = require('express') | |
const app = express() | |
// MULTER | |
const multer = require('multer') | |
const storage = multer.diskStorage({ | |
destination: function(req, file, cb) { | |
cb(null, 'uploads/') | |
}, |
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
// server/index.js | |
const express = require('express') | |
const consola = require('consola') | |
const { Nuxt, Builder } = require('nuxt') | |
const app = express() | |
// Import and Set Nuxt.js options | |
const config = require('../nuxt.config.js') | |
config.dev = process.env.NODE_ENV !== 'production' |
NewerOlder