Skip to content

Commit

Permalink
Merge pull request #27 from DesignByOnyx/master
Browse files Browse the repository at this point in the history
chore: create layouts folder, move static assets from feathers to nuxt
  • Loading branch information
marshallswain authored Feb 16, 2021
2 parents 1d1913d + 1aaecb9 commit 8863d3f
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 22 deletions.
15 changes: 15 additions & 0 deletions client/layouts/default.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<section>
<navigation />
<Nuxt />
</section>
</template>

<script>
import Navigation from '../components/navigation';
export default {
name: 'DefautlLayout',
components: { Navigation },
}
</script>
13 changes: 13 additions & 0 deletions client/layouts/error.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<main>
<h1 v-if="error.statusCode === 404">Page not found</h1>
<h1 v-else>An error occurred</h1>
<NuxtLink to="/">Home page</NuxtLink>
</main>
</template>

<script>
export default {
props: ['error'],
}
</script>
8 changes: 2 additions & 6 deletions client/pages/authenticate.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<section>
<navigation />
<main>
<h1>Authenticate!</h1>
<form class="auth-form">
<ul>
Expand All @@ -9,17 +8,14 @@
</ul>
<button :class="{ 'is-loading': isLoggingIn }" @click.prevent="login">Login</button> or <button :class="{ 'is-loading': isSigningUp }" class="ghost" @click.prevent="signup">Sign up</button>
</form>
</section>
</main>
</template>

<script>
import { mapActions } from 'vuex';
import Navigation from '../components/navigation';
export default {
name: 'Login',
components: { Navigation },
data() {
return {
email: '[email protected]',
Expand Down
8 changes: 2 additions & 6 deletions client/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
<template>
<section>
<navigation />
<main>
<h1>Feathers + Nuxt</h1>
<p>This is a <strong>very basic</strong> demo/boilerplate for <code>nuxt</code> + <code>feathers</code> + <code>feathers-vuex</code>.</p>
<p>Use the nav links above to switch between pages. There's a secret page that requires user authentication.</p>
<p>For simplicity's sake, the <code>users</code> service is using NeDB. Feel free to switch to MongoDB, PostgreSQL, or whatever you feel like using.</p>
</section>
</main>
</template>

<script>
import Navigation from '../components/navigation';
export default {
name: 'Home',
components: { Navigation }
}
</script>

7 changes: 2 additions & 5 deletions client/pages/secret.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
<template>
<section>
<navigation />
<main>
<h1>This place is secret</h1>
<p>This section requires user authentication. There's nothing else going on here.</p>
<button @click.prevent="exit">Logout</button>
</section>
</main>
</template>

<script>
import { mapActions } from 'vuex';
import Navigation from '../components/navigation';
export default {
name: 'Secret',
components: { Navigation },
methods: {
...mapActions('auth', ['logout']),
async exit() {
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"nedb": "^1.8.0",
"normalize.css": "^8.0.1",
"nuxt": "^2.14.12",
"serve-favicon": "^2.5.0",
"socket.io-client": "^2.4.0",
"winston": "^3.3.3"
},
Expand Down
5 changes: 1 addition & 4 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require('path');
const favicon = require('serve-favicon');
const compress = require('compression');
const helmet = require('helmet');
const cors = require('cors');
Expand Down Expand Up @@ -32,9 +31,7 @@ app.use(cors());
app.use(compress());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(favicon(path.join(app.get('public'), 'favicon.ico')));
// Host the public folder
app.use('/', express.static(app.get('public')));
// NOTE: all static assets are served from the nuxt static folder (including favicon.ico)

// Set up Plugins and providers
app.configure(express.rest());
Expand Down

0 comments on commit 8863d3f

Please sign in to comment.