init meteor

This commit is contained in:
Timo Volkmann 2020-06-29 13:31:36 +02:00
commit 838fb81496
18 changed files with 1494 additions and 0 deletions

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# Quickstart
## MQTT Server
Public Test Server:

View File

@ -0,0 +1,41 @@
version: '2' // '3.7'
services:
# MongoDB
mongodb:
image: mongo:latest
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: devtest
ports:
- 27017:27017
volumes:
- mongodb_data:/data/db
networks:
- mongodb_net
restart: always
# MQTT
mosquitto:
image: eclipse-mosquitto:latest
ports:
- 1883:1883
- 9001:9001
volumes:
- mosquitto_data:/mqtt
networks:
- mongodb_net
restart: always
# Backend Meteor
# Frontend
volumes:
mongodb_data:
mosquitto_data:
# custom
networks:
mongodb_net:

1
server/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules/

View File

@ -0,0 +1,19 @@
# This file contains information which helps Meteor properly upgrade your
# app when you run 'meteor update'. You should check it into version control
# with your project.
notices-for-0.9.0
notices-for-0.9.1
0.9.4-platform-file
notices-for-facebook-graph-api-2
1.2.0-standard-minifiers-package
1.2.0-meteor-platform-split
1.2.0-cordova-changes
1.2.0-breaking-changes
1.3.0-split-minifiers-package
1.4.0-remove-old-dev-bundle-link
1.4.1-add-shell-server-package
1.4.3-split-account-service-packages
1.5-add-dynamic-import-package
1.7-split-underscore-from-meteor-base
1.8.3-split-jquery-from-blaze

1
server/.meteor/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
local

7
server/.meteor/.id Normal file
View File

@ -0,0 +1,7 @@
# This file contains a token that is unique to your project.
# Check it into your repository along with the rest of this directory.
# It can be used for purposes such as:
# - ensuring you don't accidentally deploy one app on top of another
# - providing package authors with aggregated statistics
ihu31ec3qsrr.y6fwoj8zicxf

23
server/.meteor/packages Normal file
View File

@ -0,0 +1,23 @@
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
meteor-base@1.4.0 # Packages every Meteor app needs to have
mobile-experience@1.1.0 # Packages for a great mobile UX
mongo@1.10.0 # The database Meteor supports right now
blaze-html-templates # Compile .html files into Meteor Blaze views
jquery # Wrapper package for npm-installed jquery
reactive-var@1.0.11 # Reactive variable for tracker
tracker@1.2.0 # Meteor's client-side reactive programming library
standard-minifier-css@1.6.0 # CSS minifier run for production mode
standard-minifier-js@2.6.0 # JS minifier run for production mode
es5-shim@4.8.0 # ECMAScript 5 compatibility for older browsers
ecmascript@0.14.3 # Enable ECMAScript2015+ syntax in app code
typescript@3.7.6 # Enable TypeScript syntax in .ts and .tsx modules
shell-server@0.5.0 # Server-side component of the `meteor shell` command
autopublish@1.0.7 # Publish all data to the clients (for prototyping)
insecure@1.0.7 # Allow all DB writes from clients (for prototyping)

2
server/.meteor/platforms Normal file
View File

@ -0,0 +1,2 @@
server
browser

1
server/.meteor/release Normal file
View File

@ -0,0 +1 @@
METEOR@1.10.2

79
server/.meteor/versions Normal file
View File

@ -0,0 +1,79 @@
allow-deny@1.1.0
autopublish@1.0.7
autoupdate@1.6.0
babel-compiler@7.5.3
babel-runtime@1.5.0
base64@1.0.12
binary-heap@1.0.11
blaze@2.3.4
blaze-html-templates@1.1.2
blaze-tools@1.0.10
boilerplate-generator@1.7.0
caching-compiler@1.2.2
caching-html-compiler@1.1.3
callback-hook@1.3.0
check@1.3.1
ddp@1.4.0
ddp-client@2.3.3
ddp-common@1.4.0
ddp-server@2.3.1
deps@1.0.12
diff-sequence@1.1.1
dynamic-import@0.5.2
ecmascript@0.14.3
ecmascript-runtime@0.7.0
ecmascript-runtime-client@0.10.0
ecmascript-runtime-server@0.9.0
ejson@1.1.1
es5-shim@4.8.0
fetch@0.1.1
geojson-utils@1.0.10
hot-code-push@1.0.4
html-tools@1.0.11
htmljs@1.0.11
id-map@1.1.0
insecure@1.0.7
inter-process-messaging@0.1.1
jquery@3.0.0
launch-screen@1.2.0
livedata@1.0.18
logging@1.1.20
meteor@1.9.3
meteor-base@1.4.0
minifier-css@1.5.0
minifier-js@2.6.0
minimongo@1.6.0
mobile-experience@1.1.0
mobile-status-bar@1.1.0
modern-browsers@0.1.5
modules@0.15.0
modules-runtime@0.12.0
mongo@1.10.0
mongo-decimal@0.1.1
mongo-dev-server@1.1.0
mongo-id@1.0.7
npm-mongo@3.7.0
observe-sequence@1.0.16
ordered-dict@1.1.0
promise@0.11.2
random@1.2.0
reactive-var@1.0.11
reload@1.3.0
retry@1.1.0
routepolicy@1.1.0
shell-server@0.5.0
socket-stream-client@0.3.0
spacebars@1.0.15
spacebars-compiler@1.1.3
standard-minifier-css@1.6.0
standard-minifier-js@2.6.0
templating@1.3.2
templating-compiler@1.3.3
templating-runtime@1.3.2
templating-tools@1.1.2
tracker@1.2.0
typescript@3.7.6
ui@1.0.13
underscore@1.0.10
webapp@1.9.1
webapp-hashing@1.0.9

4
server/client/main.css Normal file
View File

@ -0,0 +1,4 @@
body {
padding: 10px;
font-family: sans-serif;
}

25
server/client/main.html Normal file
View File

@ -0,0 +1,25 @@
<head>
<title>server</title>
</head>
<body>
<h1>Welcome to Meteor!</h1>
{{> hello}}
{{> info}}
</body>
<template name="hello">
<button>Click Me</button>
<p>You've pressed the button {{counter}} times.</p>
</template>
<template name="info">
<h2>Learn Meteor!</h2>
<ul>
<li><a href="https://www.meteor.com/try" target="_blank">Do the Tutorial</a></li>
<li><a href="http://guide.meteor.com" target="_blank">Follow the Guide</a></li>
<li><a href="https://docs.meteor.com" target="_blank">Read the Docs</a></li>
<li><a href="https://forums.meteor.com" target="_blank">Discussions</a></li>
</ul>
</template>

22
server/client/main.js Normal file
View File

@ -0,0 +1,22 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import './main.html';
Template.hello.onCreated(function helloOnCreated() {
// counter starts at 0
this.counter = new ReactiveVar(0);
});
Template.hello.helpers({
counter() {
return Template.instance().counter.get();
},
});
Template.hello.events({
'click button'(event, instance) {
// increment the counter when button is clicked
instance.counter.set(instance.counter.get() + 1);
},
});

16
server/mqtt_test.js Normal file
View File

@ -0,0 +1,16 @@
const mqtt = require('mqtt')
const client = mqtt.connect('mqtt://mqtt.timovolkmann.de')
client.on('connect', function () {
client.subscribe('smartgarden/updates', function (err) {
if (!err) {
client.publish('smartgarden/updates', 'Hello mqtt')
}
})
})
client.on('message', function (topic, message) {
// message is Buffer
console.log('topic:', topic.toString(), 'message:', message.toString())
//client.end()
})

1200
server/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

23
server/package.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "server",
"private": true,
"scripts": {
"start": "meteor run",
"test": "meteor test --once --driver-package meteortesting:mocha",
"test-app": "TEST_WATCH=1 meteor test --full-app --driver-package meteortesting:mocha",
"visualize": "meteor --production --extra-packages bundle-visualizer"
},
"dependencies": {
"@babel/runtime": "^7.8.3",
"jquery": "^3.4.1",
"meteor-node-stubs": "^1.0.0",
"mqtt": "^4.1.0"
},
"meteor": {
"mainModule": {
"client": "client/main.js",
"server": "server/main.js"
},
"testModule": "tests/main.js"
}
}

5
server/server/main.js Normal file
View File

@ -0,0 +1,5 @@
import { Meteor } from 'meteor/meteor';
Meteor.startup(() => {
// code to run on server at startup
});

20
server/tests/main.js Normal file
View File

@ -0,0 +1,20 @@
import assert from "assert";
describe("server", function () {
it("package.json has correct name", async function () {
const { name } = await import("../package.json");
assert.strictEqual(name, "server");
});
if (Meteor.isClient) {
it("client is not server", function () {
assert.strictEqual(Meteor.isServer, false);
});
}
if (Meteor.isServer) {
it("server is not client", function () {
assert.strictEqual(Meteor.isClient, false);
});
}
});