Giter Site home page Giter Site logo

mastering_typescript's Introduction

Mastering TypeScript - Slice-it Pizza Sample Application

Overview

Slice-it Pizza is a simple food order management system.

It allows the user to input food items and orders containing specific food items.

Recommended Text Editor

This code is designed to be used with Visual Studio Code. It's free and runs on Windows, OS X, and Linux.

Individually open up the web-app folder and server-app folder.

Setup

Download and install Node.js 4.1+.

In the server-app run:

~/server-app> npm install
~/server-app> gulp
~/server-app> npm start

Then in the web-app run:

~/web-app> npm install
~/web-app> gulp
~/web-app> npm start
  • npm install - Installs the application dependencies
  • gulp - Builds the application
  • npm start - Starts the application

Make sure to start the server-app before running the web-app. Otherwise the web-app will have nothing to connect to.

server-app

Listens for requests to list/insert/update/remove food items and orders from a database.

See ~/server-app/readme.md for more details.

web-app

Interacts with the server-app to list/insert/update/remove food items and orders.

The user is displayed information and they can view/add/update/remove food items and orders.

See ~/web-app/readme.md for more details.

Section 8, Video 3 - Code Generation

More information in Section 8, Video 3 on Code Generation.

Code is generated from the FoodItemRoutes and OrderRoutes classes in the server-app to the ServerFoodItems and ServerOrders classes in the web-app, respectively. Other related files are also copied to the web-app from the server-app.

  • Code generation: ~/server-app/src/routes/food-item-routes.ts -> ~/web-app/src/scripts/server/server.ts as ServerFoodItems
  • Code generation: ~/server-app/src/routes/order-routes.ts -> ~/web-app/src/scripts/server/server.ts as ServerOrders
  • Copied files: ~/server-app/src/models/* -> ~/web-app/src/scripts/server/*

Code generation and copying happens when running the gulp copy-server-files or just gulp command is run in the ~/server-app folder. It does this by using an experimental library called server-bridge, which gets type information from the code by using another experimental library called ts-type-info then writes some code the web-app can use to easily interact with the server.

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.