Skip to content

Commit

Redid installation. Vue frontend installed

John Petersoncommitted Parent83ad040Browse files
29 files+12267−18710/29 viewed
+0−3
1−node_modules
2−npm-debug.log
3−.git
+0−17
1−lib-cov
2−*.seed
3−*.log
4−*.csv
5−*.dat
6−*.out
7−*.pid
8−*.gz
9−
10−pids
11−logs
12−results
13−build
14−
15−node_modules
16−
17−.vscode
+0−18
1−# https://blog.logrocket.com/node-js-docker-improve-dx/
2−FROM node:14-alpine as base
3−
4−WORKDIR /src
5−COPY package*.json /
6−EXPOSE 3000
7−
8−FROM base as production
9−ENV NODE_ENV=production
10−RUN npm ci
11−COPY . /
12−CMD ["node", "bin/www"]
13−
14−FROM base as dev
15−ENV NODE_ENV=development
16−RUN npm install -g nodemon && npm install
17−COPY . /
18−CMD ["nodemon", "bin/www"]
+0−41
1−var createError = require('http-errors');
2−var express = require('express');
3−var path = require('path');
4−var cookieParser = require('cookie-parser');
5−var logger = require('morgan');
6−
7−var indexRouter = require('./routes/index');
8−var usersRouter = require('./routes/users');
9−
10−var app = express();
11−
12−// view engine setup
13−app.set('views', path.join(__dirname, 'views'));
14−app.set('view engine', 'jade');
15−
16−app.use(logger('dev'));
17−app.use(express.json());
18−app.use(express.urlencoded({ extended: false }));
19−app.use(cookieParser());
20−app.use(express.static(path.join(__dirname, 'public')));
21−
22−app.use('/', indexRouter);
23−app.use('/users', usersRouter);
24−
25−// catch 404 and forward to error handler
26−app.use(function(req, res, next) {
27− next(createError(404));
28−});
29−
30−// error handler
31−app.use(function(err, req, res, next) {
32− // set locals, only providing error in development
33− res.locals.message = err.message;
34− res.locals.error = req.app.get('env') === 'development' ? err : {};
35−
36− // render the error page
37− res.status(err.status || 500);
38− res.render('error');
39−});
40−
41−module.exports = app;
+0−90
1−#!/usr/bin/env node
2−
3−/**
4− * Module dependencies.
5− */
6−
7−var app = require('../app');
8−var debug = require('debug')('todo-app:server');
9−var http = require('http');
10−
11−/**
12− * Get port from environment and store in Express.
13− */
14−
15−var port = normalizePort(process.env.PORT || '3000');
16−app.set('port', port);
17−
18−/**
19− * Create HTTP server.
20− */
21−
22−var server = http.createServer(app);
23−
24−/**
25− * Listen on provided port, on all network interfaces.
26− */
27−
28−server.listen(port);
29−server.on('error', onError);
30−server.on('listening', onListening);
31−
32−/**
33− * Normalize a port into a number, string, or false.
34− */
35−
36−function normalizePort(val) {
37− var port = parseInt(val, 10);
38−
39− if (isNaN(port)) {
40− // named pipe
41− return val;
42− }
43−
44− if (port >= 0) {
45− // port number
46− return port;
47− }
48−
49− return false;
50−}
51−
52−/**
53− * Event listener for HTTP server "error" event.
54− */
55−
56−function onError(error) {
57− if (error.syscall !== 'listen') {
58− throw error;
59− }
60−
61− var bind = typeof port === 'string'
62− ? 'Pipe ' + port
63− : 'Port ' + port;
64−
65− // handle specific listen errors with friendly messages
66− switch (error.code) {
67− case 'EACCES':
68− console.error(bind + ' requires elevated privileges');
69− process.exit(1);
70− break;
71− case 'EADDRINUSE':
72− console.error(bind + ' is already in use');
73− process.exit(1);
74− break;
75− default:
76− throw error;
77− }
78−}
79−
80−/**
81− * Event listener for HTTP server "listening" event.
82− */
83−
84−function onListening() {
85− var addr = server.address();
86− var bind = typeof addr === 'string'
87− ? 'pipe ' + addr
88− : 'port ' + addr.port;
89− debug('Listening on ' + bind);
90−}
+20−13
1−version: '3.8'
2−
1+version: '3'
32 services:
4− todoapp:
5− image: todoapp
3+# nodejs-server:
4+# build:
5+# context: ./api
6+# dockerfile: Dockerfile-dev
7+# ports:
8+# - "3080:3080"
9+# container_name: node-api
10+# volumes:
11+# - ./api:/usr/src/app/api
12+# - /usr/src/app/api/node_modules
13+
14+ vue-frontend:
615 build:
7− context: ./
8− target: dev
16+ context: ./frontend
17+ dockerfile: Dockerfile
18+ ports:
19+ - "8080:8080"
20+ working_dir: "/src/app"
21+ container_name: vue-frontend
922 volumes:
10− - .:/src
11− command: "npm run start:dev"
12− environment:
13− NODE_ENV: development
14− DEBUG: nodejs-docker-express:*
15− ports:
16− - 3000:3000
23+ - ./frontend:/src/app
+1−0
1+node_modules
+23−0
1+.DS_Store
2+node_modules
3+/dist
4+
5+
6+# local env files
7+.env.local
8+.env.*.local
9+
10+# Log files
11+npm-debug.log*
12+yarn-debug.log*
13+yarn-error.log*
14+pnpm-debug.log*
15+
16+# Editor directories and files
17+.idea
18+.vscode
19+*.suo
20+*.ntvs*
21+*.njsproj
22+*.sln
23+*.sw?
+13−0
1+FROM node:14-alpine
2+
3+WORKDIR /src/app
4+
5+COPY package*.json /src/app
6+
7+COPY . /src/app/
8+
9+RUN npm install
10+
11+EXPOSE 8080
12+
13+CMD ["npm", "run", "serve"]
+24−0
1+# frontend
2+
3+## Project setup
4+```
5+npm install
6+```
7+
8+### Compiles and hot-reloads for development
9+```
10+npm run serve
11+```
12+
13+### Compiles and minifies for production
14+```
15+npm run build
16+```
17+
18+### Lints and fixes files
19+```
20+npm run lint
21+```
22+
23+### Customize configuration
24+See [Configuration Reference](https://cli.vuejs.org/config/).
+5−0
1+module.exports = {
2+ presets: [
3+ '@vue/cli-plugin-babel/preset'
4+ ]
5+}
+12028−0
A large diff (12,028 lines) is not shown until you ask for it.
+42−0
1+{
2+ "name": "frontend",
3+ "version": "0.1.0",
4+ "private": true,
5+ "scripts": {
6+ "serve": "vue-cli-service serve",
7+ "build": "vue-cli-service build",
8+ "lint": "vue-cli-service lint"
9+ },
10+ "dependencies": {
11+ "core-js": "^3.6.5",
12+ "vue": "^2.6.11"
13+ },
14+ "devDependencies": {
15+ "@vue/cli-plugin-babel": "~4.5.0",
16+ "@vue/cli-plugin-eslint": "~4.5.0",
17+ "@vue/cli-service": "~4.5.0",
18+ "babel-eslint": "^10.1.0",
19+ "eslint": "^6.7.2",
20+ "eslint-plugin-vue": "^6.2.2",
21+ "vue-template-compiler": "^2.6.11"
22+ },
23+ "eslintConfig": {
24+ "root": true,
25+ "env": {
26+ "node": true
27+ },
28+ "extends": [
29+ "plugin:vue/essential",
30+ "eslint:recommended"
31+ ],
32+ "parserOptions": {
33+ "parser": "babel-eslint"
34+ },
35+ "rules": {}
36+ },
37+ "browserslist": [
38+ "> 1%",
39+ "last 2 versions",
40+ "not dead"
41+ ]
42+}
+0−0

Binary or large file; its contents are not shown.

+17−0
1+<!DOCTYPE html>
2+<html lang="">
3+ <head>
4+ <meta charset="utf-8">
5+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
7+ <link rel="icon" href="<%= BASE_URL %>favicon.ico">
8+ <title><%= htmlWebpackPlugin.options.title %></title>
9+ </head>
10+ <body>
11+ <noscript>
12+ <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13+ </noscript>
14+ <div id="app"></div>
15+ <!-- built files will be auto injected -->
16+ </body>
17+</html>
+28−0
1+<template>
2+ <div id="app">
3+ <img alt="Vue logo" src="./assets/logo.png">
4+ <HelloWorld msg="Welcome to Your Vue.js App"/>
5+ </div>
6+</template>
7+
8+<script>
9+import HelloWorld from './components/HelloWorld.vue'
10+
11+export default {
12+ name: 'App',
13+ components: {
14+ HelloWorld
15+ }
16+}
17+</script>
18+
19+<style>
20+#app {
21+ font-family: Avenir, Helvetica, Arial, sans-serif;
22+ -webkit-font-smoothing: antialiased;
23+ -moz-osx-font-smoothing: grayscale;
24+ text-align: center;
25+ color: #2c3e50;
26+ margin-top: 60px;
27+}
28+</style>
+0−0

Binary or large file; its contents are not shown.

+58−0
1+<template>
2+ <div class="hello">
3+ <h1>{{ msg }}</h1>
4+ <p>
5+ For a guide and recipes on how to configure / customize this project,<br>
6+ check out the
7+ <a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
8+ </p>
9+ <h3>Installed CLI Plugins</h3>
10+ <ul>
11+ <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
12+ <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
13+ </ul>
14+ <h3>Essential Links</h3>
15+ <ul>
16+ <li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
17+ <li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
18+ <li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
19+ <li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
20+ <li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
21+ </ul>
22+ <h3>Ecosystem</h3>
23+ <ul>
24+ <li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
25+ <li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
26+ <li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
27+ <li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
28+ <li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
29+ </ul>
30+ </div>
31+</template>
32+
33+<script>
34+export default {
35+ name: 'HelloWorld',
36+ props: {
37+ msg: String
38+ }
39+}
40+</script>
41+
42+<!-- Add "scoped" attribute to limit CSS to this component only -->
43+<style scoped>
44+h3 {
45+ margin: 40px 0 0;
46+}
47+ul {
48+ list-style-type: none;
49+ padding: 0;
50+}
51+li {
52+ display: inline-block;
53+ margin: 0 10px;
54+}
55+a {
56+ color: #42b983;
57+}
58+</style>
+8−0
1+import Vue from 'vue'
2+import App from './App.vue'
3+
4+Vue.config.productionTip = false
5+
6+new Vue({
7+ render: h => h(App),
8+}).$mount('#app')
+0−1597
A large diff (1,597 lines) is not shown until you ask for it.
+0−19
1−{
2− "name": "todo-app",
3− "version": "0.0.0",
4− "private": true,
5− "scripts": {
6− "start": "node ./bin/www",
7− "start:dev": "nodemon ./bin/www"
8− },
9− "dependencies": {
10− "cookie-parser": "~1.4.4",
11− "debug": "~2.6.9",
12− "express": "~4.16.1",
13− "http-errors": "~1.6.3",
14− "jade": "~1.11.0",
15− "morgan": "~1.9.1",
16− "nodemon": "^2.0.12",
17− "vue": "^2.6.14"
18− }
19−}
+0−6
1−var app = new Vue({
2− el: '#app',
3− data: {
4− message: 'Hello Vue!'
5− }
6− })
+0−8
1−body {
2− padding: 50px;
3− font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
4−}
5−
6−a {
7− color: #00B7FF;
8−}
+0−13
1−var express = require('express');
2−var router = express.Router();
3−
4−/* GET home page. */
5−// router.get('/', function(req, res, next) {
6−// res.render('index', { title: 'Express' });
7−// });
8−
9−router.get('/', function(req, res) {
10− res.send('Some data here 3');
11−});
12−
13−module.exports = router;
+0−9
1−var express = require('express');
2−var router = express.Router();
3−
4−/* GET users listing. */
5−router.get('/', function(req, res, next) {
6− res.send('respond with a resource');
7−});
8−
9−module.exports = router;
+0−6
1−extends layout
2−
3−block content
4− h1= message
5− h2= error.status
6− pre #{error.stack}
+0−19
1−<!doctype html>
2−<html>
3− <head>
4− <title>This is the title of the webpage!</title>
5− <!-- development version, includes helpful console warnings -->
6− <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
7− </head>
8− <body>
9− <p>This is an example paragraph. Anything in the <strong>body</strong> tag will appear on the page, just like this <strong>p</strong> tag and its contents.</p>
10−
11− <div id="app">
12− {{ message }}
13− </div>
14−
15− <script src="/public/javascripts/index.js"></script>
16−
17− </body>
18−
19−</html>
+0−5
1−extends layout
2−
3−block content
4− h1= title
5− p Welcome to #{title}
+0−7
1−doctype html
2−html
3− head
4− title= title
5− link(rel='stylesheet', href='/stylesheets/style.css')
6− body
7− block content

Comments

Sign in to comment.