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
| const puppeteer = require('puppeteer'); | |
| const { Storage } = require('@google-cloud/storage'); | |
| const GOOGLE_CLOUD_PROJECT_ID = "screenshotapi"; | |
| const BUCKET_NAME = "screenshot-api-net"; | |
| exports.run = async (req, res) => { | |
| res.setHeader("content-type", "application/json"); | |
| try { |
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
| const express = require('express'); | |
| const randomEmoji = require('random-unicode-emoji'); | |
| const app = express(); | |
| app.get('/', (req, res) => { | |
| const emojis = randomEmoji.random({ count: 10 }); | |
| res.send(emojis.join("")); | |
| }); |
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
| FROM node:12-slim | |
| # Create an app directory in the docker | |
| WORKDIR /app | |
| # Copy the package.json and package-lock.json. | |
| COPY package*.json ./ | |
| # Install production dependencies. | |
| RUN npm install --only=production |
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> | |
| <p>Your name is {{ name }}</p> | |
| </template> | |
| <script> | |
| export default { | |
| data() { return { | |
| name: "Dirk", | |
| } }, | |
| } | |
| </script> |
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 Vue from "vue"; | |
| import Vuex from "vuex"; | |
| Vue.use(Vuex); | |
| export default new Vuex.Store({ | |
| // This is the state of the application. | |
| state: { | |
| todos: [ | |
| { |
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> | |
| <div id="app"> | |
| <h1>Todo App</h1> | |
| <ul> | |
| <li v-for="todo in todos" :key="todo.message"> | |
| {{ todo.message }} | |
| </li> | |
| </ul> | |
| </div> | |
| </template> |
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> | |
| <div id="app"> | |
| <h1>Todo App</h1> | |
| <input type="text" @keyup.enter="addTodo()" v-model="message" placeholder="Add a to-do"> | |
| <ul> | |
| <li v-for="todo in todos" :key="todo.message"> | |
| {{ todo.message }} | |
| </li> | |
| </ul> | |
| </div> |
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
| actions: { | |
| async addTodo({ commit }, todo) { | |
| // This is a fake function to illustrate the example. | |
| const response = await postRequestToTheAPI(todo); | |
| if (response.isOk) { | |
| commit('ADD_TODO', todo); | |
| } | |
| } | |
| } |
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> | |
| <div id="app" style="font-size: 24px;"> | |
| <p>Quote of the day:</p> | |
| <p> | |
| {{ quote }} | |
| </p> | |
| </div> | |
| </template> | |
| <script> |
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.get('/quote', (req, res) => { | |
| res.set('Access-Control-Allow-Origin', 'http://localhost:8080'); | |
| res.send({ | |
| quote: "The way to get started is to quit talking and begin doing." | |
| }); | |
| }) |
OlderNewer