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
var elixir = require('laravel-elixir'); | |
elixir.config.assetsPath = 'src'; | |
elixir.config.publicPath = 'dist'; | |
elixir(function(mix) { | |
mix.browserSync({ | |
files: ['**/*.html', '**/*.css', '**/*.js'] | |
}); | |
mix.browserify('app.js'); | |
mix.sass('app.scss'); |
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
let Todos = new Mongo.Collection('todos'); | |
if (Meteor.isClient) { | |
let App = Vue.component('app', { | |
template: '#app', | |
data() { | |
return { | |
todos: [], | |
newTodo: '' | |
} |
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
<head> | |
<title>meteor-vue-todo</title> | |
</head> | |
<body> | |
<app></app> | |
<template id="app"> | |
<div class="app"> | |
<h1>Meteor Vue Todos</h1> |
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
let Todos = new Mongo.Collection('todos'); | |
let App = Vue.component('app', { | |
template: '#app', | |
data() { | |
return { | |
todos: [] | |
} | |
}, | |
created() { | |
Tracker.autorun( () => this.todos = Todos.find().fetch() ); |
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
if (Meteor.isClient) { | |
Meteor.startup(() => { | |
new Vue({ | |
el: 'body', | |
}); | |
}); | |
} |
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 App from 'components/app'; | |
new Vue({ | |
el: 'body', | |
components: { App }, | |
}); |
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 { Meteor } from 'meteor/meteor'; | |
WebApp.connectHandlers.use('/file', (req, res) => { | |
// We only care about PUT methods | |
res.setHeader("Access-Control-Allow-Methods", "PUT"); | |
// I am running meteor as a backend, see https://iamlawrence.me/agnostic-meteor | |
// Therefore we need to enable CORS | |
res.setHeader("Access-Control-Allow-Origin", "*"); | |
res.setHeader("Access-Control-Allow-Headers", "Content-Type"); |
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 { Meteor } from 'meteor/meteor'; | |
WebApp.connectHandlers.use('/file', (req, res) => { | |
res.setHeader("Access-Control-Allow-Methods", "PUT"); | |
res.setHeader("Access-Control-Allow-Origin", "*"); | |
res.setHeader("Access-Control-Allow-Headers", "Content-Type"); | |
if (req.method === 'OPTIONS') { | |
res.writeHead(200); | |
res.end(); |
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
<input type="file"> | |
<script> | |
var el = document.querySelector('input[type="file"]'); | |
el.addEventListener('change', function(event) { | |
let files = e.target.files; | |
for (let i = 0; i < files.length; i++) { | |
let file = files[i]; | |
var xhr = new XMLHttpRequest(); |
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
<input type="file"> | |
<script> | |
var el = document.querySelector('input[type="file"]'); | |
el.addEventListener('change', function(event) { | |
let files = e.target.files; | |
for (let i = 0; i < files.length; i++) { | |
let file = files[i]; | |
var xhr = new XMLHttpRequest(); | |
// set the url to wherever you meteor app is running |
OlderNewer