NODE II

Node

A JavaScript runtime environment built off of the Chrome V8 engine.

Express

A backend framework built on top of Node. Allows us to quickly build a server.

Server

The backend of our site. Used to perform business logic and then send it back to the front end, or client

Frontend - Backend

Front End

  • HTML
  • CSS
  • JavaScript
  • React

Backend

  • JavaScript
  • Express
  • PostgreSQL

Express Setup

// importing code
const express = require('express')
const app = express()

// endpoints, or routes that our users will hit 
// from front end to perform some action
app.get('/api/users', (request, response) => {
    response.status(200).send(users)
})

// starting our server
const PORT = 3333
app.listen(PORT, () => console.log(`app running on ${PORT}`))

Endpoints

app.get('/api/users', (request, response) => {


    response.status(200).send(users)
})

URL ending

Callback function with a request and response param. We use the request to see if the user sent anything and the response to send something back to the user. Often called handler

Business logic. In this case we are just sending back all users

Sling
Some
Code

Made with Slides.com