Premium Features

Download Video

How to Build Web Apps with Node.js - Project Setup

Published 5 years ago

A web app is typically a bit different than your standard static website. Rather than just displaying content, a web app helps serve some sort of functionality in which a user can achieve a goal through web based input / output. They typically involve creating some sort of registration system in which a user can:

  1. Create an account

  2. Log into their account

  3. And log out of their account

When a user logs into their account, they've proven that they are the account owner, thus they can begin to perform user-specific actions which are private to them, such as depositing money into their bank account, creating a post on their Twitter timeline, or completing a code challenge on Chris Courses.

This course will teach you everything you need to know to begin creating your own web apps, so you can begin making change in the world through web technologies. Specifically, we'll be covering how to develop your own registration and authentication system from the ground up, using Nuxt and Express.js as our main frontend and backend frameworks.

In this lesson, you'll learn a bit more about web apps, how to install Nuxt with NPM, and then how to create and integrate a backend express server with the newly created Nuxt app.

Some code you'll need for your backend express server is below:

server/app.js
const { loadNuxt, build } = require('nuxt')

const app = require('express')()
const isDev = process.env.NODE_ENV !== 'production'
const port = process.env.PORT || 3000

async function start() {
  // We get Nuxt instance
  const nuxt = await loadNuxt(isDev ? 'dev' : 'start')

  // Render every route with Nuxt.js
  app.use(nuxt.render)

  // Build only in dev mode with hot-reloading
  if (isDev) {
    build(nuxt)
  }
  // Listen the server
  app.listen(port, '0.0.0.0')
  console.log('Server listening on `localhost:' + port + '`.')
}

start()

Grabbed from: https://nuxtjs.org/docs/2.x/internals-glossary/nuxt-render/

Comments

Want to participate?

Create a free Chris Courses account to begin

Login
MILLAREMARK420 posted 10 months ago
0
MILLAREMARK420 posted 10 months ago
0
B
Boban posted 2 years ago
0
B
Boban posted 2 years ago
0
B
Boban posted 2 years ago
0
B
Boban posted 2 years ago
0
B
Boban posted 2 years ago
0
d
dshhh posted 4 years ago
1
chris posted 4 years ago
1
d
dshhh posted 4 years ago
0
chris posted 4 years ago
0
c
claybeast posted 4 years ago
0
C
Catley posted 5 years ago
1
chris posted 5 years ago
0
S
S255y posted 5 years ago
0
chris posted 5 years ago
1

Providing the lift to launch your development career

© 2024 Chris Courses. All rights reserved.