transfer
This commit is contained in:
5
attendancetracker/API/DB.js
Normal file
5
attendancetracker/API/DB.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// DB.js
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
DB: 'mongodb://localhost:27017/mevncrud'
|
||||||
|
}
|
||||||
0
attendancetracker/API/post.model.js
Normal file
0
attendancetracker/API/post.model.js
Normal file
0
attendancetracker/API/post.route.js
Normal file
0
attendancetracker/API/post.route.js
Normal file
21
attendancetracker/API/server.js
Normal file
21
attendancetracker/API/server.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const app = express();
|
||||||
|
const bodyParser = require('body-parser');
|
||||||
|
const PORT = 4000;
|
||||||
|
const cors = require('cors');
|
||||||
|
const mongoose = require('mongoose');
|
||||||
|
const config = require('./DB.js');
|
||||||
|
|
||||||
|
mongoose.Promise = global.Promise;
|
||||||
|
mongoose.connect(config.DB, { useNewUrlParser: true }).then(
|
||||||
|
() => {console.log('Database is connected') },
|
||||||
|
err => { console.log('Can not connect to the database'+ err)}
|
||||||
|
);
|
||||||
|
|
||||||
|
app.use(cors());
|
||||||
|
app.use(bodyParser.urlencoded({extended: true}));
|
||||||
|
app.use(bodyParser.json());
|
||||||
|
|
||||||
|
app.listen(PORT, function(){
|
||||||
|
console.log('Server is running on Port:',PORT);
|
||||||
|
});
|
||||||
13
attendancetracker/package-lock.json
generated
13
attendancetracker/package-lock.json
generated
@@ -2467,6 +2467,14 @@
|
|||||||
"node-releases": "^1.1.47"
|
"node-releases": "^1.1.47"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"buefy": {
|
||||||
|
"version": "0.8.12",
|
||||||
|
"resolved": "https://registry.npmjs.org/buefy/-/buefy-0.8.12.tgz",
|
||||||
|
"integrity": "sha512-scKb+0piTAEYk8mopu5HzshlGsT0K9ChlfkGhQgAF7jC9lH3Ta7anYXG+l8uBoSpqgChK0H19jPP55FbeKn1nA==",
|
||||||
|
"requires": {
|
||||||
|
"bulma": "0.7.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
"buffer": {
|
"buffer": {
|
||||||
"version": "4.9.2",
|
"version": "4.9.2",
|
||||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz",
|
"resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz",
|
||||||
@@ -2508,6 +2516,11 @@
|
|||||||
"integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=",
|
"integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"bulma": {
|
||||||
|
"version": "0.7.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/bulma/-/bulma-0.7.5.tgz",
|
||||||
|
"integrity": "sha512-cX98TIn0I6sKba/DhW0FBjtaDpxTelU166pf7ICXpCCuplHWyu6C9LYZmL5PEsnePIeJaiorsTEzzNk3Tsm1hw=="
|
||||||
|
},
|
||||||
"bytes": {
|
"bytes": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.19.2",
|
"axios": "^0.19.2",
|
||||||
|
"buefy": "^0.8.12",
|
||||||
"core-js": "^3.6.4",
|
"core-js": "^3.6.4",
|
||||||
"vue": "^2.6.11",
|
"vue": "^2.6.11",
|
||||||
"vue-axios": "^2.1.5",
|
"vue-axios": "^2.1.5",
|
||||||
|
|||||||
0
attendancetracker/public/style.css
Normal file
0
attendancetracker/public/style.css
Normal file
@@ -1,24 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app">
|
|
||||||
<img alt="Vue logo" src="./assets/logo.png">
|
<div class="container">
|
||||||
<HelloWorld msg="Welcome to Your Vue.js App"/>
|
<transition name="fade">
|
||||||
|
<router-view></router-view>
|
||||||
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
|
||||||
import HelloWorld from './components/HelloWorld.vue'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'App',
|
|
||||||
components: {
|
|
||||||
HelloWorld
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
#app {
|
#app {
|
||||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
font-family: 'Avenir', Helvetica, Arial, sans-serif;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="hello">
|
<div class="hello">
|
||||||
<h1>{{ msg }}</h1>
|
<h1>Johnny is horrible </h1>
|
||||||
<p>
|
<p>
|
||||||
For a guide and recipes on how to configure / customize this project,<br>
|
For a guid:e and recipes on how to configure / customize this project,<br>
|
||||||
check out the
|
check out the
|
||||||
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
|
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
37
attendancetracker/src/components/Login.vue
Normal file
37
attendancetracker/src/components/Login.vue
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<template>
|
||||||
|
<div class="login-box">
|
||||||
|
<h1 class="title">Login</h1>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Name</label>
|
||||||
|
<div class="control">
|
||||||
|
<input class="input" type="text" placeholder="e.g Alex Smith">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Email</label>
|
||||||
|
<div class="control">
|
||||||
|
<input class="input" type="email" placeholder="e.g. alexsmith@gmail.com">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
post:{}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
login(){
|
||||||
|
let uri = 'http://localhost:4000/posts/add';
|
||||||
|
this.axios.post(uri, this.post).then(() => {
|
||||||
|
this.$router.push({name: 'posts'});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -1,8 +1,35 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
|
import Buefy from 'buefy'
|
||||||
|
|
||||||
|
Vue.use(Buefy)
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
new Vue({
|
import VueRouter from 'vue-router';
|
||||||
render: h => h(App),
|
Vue.use(VueRouter);
|
||||||
}).$mount('#app')
|
|
||||||
|
import VueAxios from 'vue-axios';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
Vue.use(VueAxios, axios);
|
||||||
|
Vue.config.productionTip = false;
|
||||||
|
|
||||||
|
import HelloWorld from './components/HelloWorld.vue';
|
||||||
|
import Login from './components/Login.vue';
|
||||||
|
|
||||||
|
const routes = [
|
||||||
|
{
|
||||||
|
name: 'home',
|
||||||
|
path: '/',
|
||||||
|
component: HelloWorld
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'login',
|
||||||
|
path: '/login',
|
||||||
|
component: Login
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const router = new VueRouter({ mode: 'history', routes: routes});
|
||||||
|
|
||||||
|
new Vue(Vue.util.extend({ router }, App)).$mount('#app');
|
||||||
Reference in New Issue
Block a user