Browse Source

first one

etienne 5 years ago
commit
ec6e73e338
5 changed files with 63 additions and 0 deletions
  1. 1 0
      client/main.css
  2. 25 0
      client/main.html
  3. 22 0
      client/main.js
  4. 10 0
      package.json
  5. 5 0
      server/main.js

+ 1 - 0
client/main.css

@@ -0,0 +1 @@
+/* CSS declarations go here */

+ 25 - 0
client/main.html

@@ -0,0 +1,25 @@
+<head>
+  <title>tera</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 - 0
client/main.js

@@ -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);
+  },
+});

+ 10 - 0
package.json

@@ -0,0 +1,10 @@
+{
+  "name": "tera",
+  "private": true,
+  "scripts": {
+    "start": "meteor run"
+  },
+  "dependencies": {
+    "meteor-node-stubs": "~0.2.0"
+  }
+}

+ 5 - 0
server/main.js

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