I hereby claim:
- I am thgaskell on github.
- I am thgaskell (https://keybase.io/thgaskell) on keybase.
- I have a public key ASAxNZp0H4yBT01iTtYYwRSBVqYADK8D-ciTgo_CyVDwowo
To claim this, I am signing this object:
import { parse } from "https://deno.land/std/flags/mod.ts"; | |
function greet(name?: string): void { | |
if (!name) { | |
console.log('Hello, World!'); | |
} else { | |
console.log(`Hello, ${name}!`); | |
} | |
} |
I hereby claim:
To claim this, I am signing this object:
module.exports = { | |
create: function () { | |
var display = [ | |
{ name: "chips", price: 0.75, quantity: 5 }, | |
{ name: "soda", price: 1.50, quantity: 0 }, | |
{ name: "candy", price: 1.00, quantity: 5 } | |
]; | |
var vendingMachine = { | |
"restock": function (itemIndex) { |
Basic authentication is one of the simplest authentication strategies because it doesn't require cookies, sessions, or even a login form! Instead, it uses HTTP headers which means credentials are transmitted on each request.
You will need to install passport
and passport-http
. The passport-http
module is what allows you set up the Basic Authentication Scheme, in addition to a couple other authentication strategies.
$ npm install express passport passport-http --save
Using your existing Pixel Painter project, we're going to upgrade it to use Express (if it isn't already).
In addition, intialize the project with sequelize
, to create the folders: config
, migrations
, and models
.
Now that we know a little bit about creating migrations, let's use Sequelize to create a couple migration files.
sequelize model:create
to create model and migration files for a Drawing
table.Drawing
table is that it must have a data
column, with the data type json
.Just like how we use Git to version control source code, we use migrations to manage the state of our database schemas.
Imagine you're working on project with another developer, and you're both tasked with creating a specific part of an event planning application. Let's say you are in charge of creating the Users
and your friend is going to create the Events
.
Let's say you and your friend divided the work in a way so that neither of you will have to to use each other's code to finish your tasks. While you're working on your part of the application, you only really need to touch the Users
table when you are working with the database.
Make sure that the project you are in is a node project (it has a package.json
) and you have already installed and initialized sequelize (npm install --save sequelize
, sequelize init
). Also make sure that your config.json
file has the correct credentials to connect to your database.
Based off of: http://docs.sequelizejs.com/en/1.7.0/articles/express/
Create and initialize your a directory for your Express application.
$ mkdir sequelize-demo
var Number; | |
(function (Number_1) { | |
var map = new WeakMap(); | |
var internal = function (object) { | |
if (!map.has(object)) | |
map.set(object, {}); | |
return map.get(object); | |
}; | |
var Number = (function () { | |
function Number(x) { |
File Structure:
Make sure that the SQL configs are in config.json
.