- Move your Oracle Jet folder into your ExpressJS API folder
- Or create a new folder for an small ExpressJS application
Delete these in the Oracle Jet app folder:
- the .git folder - use
rm -rf .git
- the .gitignore file - use
rm .gitignore
Delete these in the Oracle Jet app folder:
rm -rf .git
rm .gitignore
const fs = require('fs'); | |
const {promisify} = require('util'); | |
// Using Node 8.x to create a promise for us | |
let asyncReadFile = promisify(fs.readFile); | |
/** | |
Create your own Promise | |
**/ | |
function readFile(fileName){ | |
return new Promise(function(accept, reject){ |
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
let app = express(); | |
// parse application/x-www-form-urlencoded | |
app.use(bodyParser.urlencoded({ extended: false })) | |
// parse application/json | |
app.use(bodyParser.json()) |
TypeScript is a superset of JavaScript it supports ES5, ES6, ES2016, ES2017 and more. TypeScript is JavaScript, but JavaScript is not TypeScript.
TypeScript add typing to JavaScript. It allows you to add types to variables and functions, TypeScript does type checking. Type checking is the process of ensure that variables have the correct types, it ensures type safety. Type safety leads to less errors in your code as the compiler is telling you about errors early. Typing is a safety harness for your code.
TypeScript is a typed superset of JavaScript that compiles into plain JavaScript.
The TypeScript compiler transpiles (converts) the TypeScript code into plain JavaScript using the the TypeScript compiler.
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
</head> | |
<body> | |
<video id="video" width="640" height="480" autoplay></video> |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
</head> | |
<body> | |
<div class="number"></div> | |
<div class="number"></div> | |
<div class="number"></div> |
'use strict' | |
// you need to use iojs for this... or something | |
function async(myGenerator){ | |
return function(){ | |
var theGenerator = myGenerator.apply(this, arguments); | |
function handle(result){ |
require 'artoo' | |
connection :arduino, adaptor: :firmata, port: '/dev/tty.usbmodem411' | |
#connection :firmata, :adaptor => :firmata, :port => '127.0.0.1:8023' | |
device :board, :driver => :device_info | |
device :led, :driver => :led, :pin => 13 | |
work do | |
puts "Firmware name: #{board.firmware_name}" |
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
h1 { | |
color : orange; | |
} |
var page = require('webpage').create(); | |
page.onAlert = function (msg) { | |
console.log('alert!!> ' + msg); | |
}; | |
page.onConsoleMessage = function (msg, line, source) { | |
console.log('console> ' + msg); | |
}; |