Coder Social home page Coder Social logo

pizza-perfect's Introduction

Routing pizzas

This journey have a few chapters. Check back regularly for updates.

  • It starts with creating routes,
  • Next you will add data to you routes.
  • Create a Pizza cart
  • After that you will add multi user support,
  • after that you will store orders in a database,
  • then you will add pizza delivery support

While doing this let's reflect on:

  • What is a route in ExpressJS?
  • What is a GET route?
  • What is a POST route?
  • What is req and res in the route handlers?

Creating routes

Using the Handlebars Templates in the views folder create these routes:

Route name Description
/pizzas a get route to show a list of pizzas
/pizza/add a get route that contains a form - that posts to /pizza/add/
/pizza/add/ a post route for now let is redirect to the /pizzas get route.
/pizza/edit/:pizza_id a get route for editing pizzas - for now display the id passed into the route in the template. Post to /pizzas/edit.
/pizza/edit a post route for updating a pizza - for now display the id passed into the route in the template. Redirect to /pizzas for now.

When you are done your page should flow from the /pizzas route to the pizza add and edit screens. No data should be captured yet.

Use res.render to should templates and res.redirect to move to the next route. Note that you can't redirect to a post route.

Adding data to the routes

Use the PizzaService Factory Function skeleton to add data to the routes. Store pizzas on a JavaScript list []

A pizza object looks like this:

{
	id : 17,
	size : 'small',
	name : 'Chicken & Cheese',
	description : 'Our fresh new Chicken and Cheese pizza with tasty free range chicken the latest cheese flavours from the ...'
}

Add a Pizza Cart

Multiuser support

Using the database

Pizza delivery support

pizza-perfect's People

Contributors

codex-avee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.