WebDev
howlowl
这个作者很懒,什么都没留下…
展开
-
xml dom
https://www.w3schools.com/code/tryit.asp?filename=G7OC49VD1QII<!DOCTYPE html><html><body><div id='showCD'></div><script>displayCD(0);function displayCD...原创 2019-09-05 08:26:39 · 255 阅读 · 0 评论 -
Update dependency in package.json (Shopsy from lynda.com)
https://stackoverflow.com/questions/16073603/how-do-i-update-each-dependency-in-package-json-to-the-latest-versionnpm i -g npm-check-updatesncu -unpm installalso notice the change in "start...转载 2019-06-22 22:00:56 · 217 阅读 · 0 评论 -
advanced express
转载 2019-06-26 04:02:13 · 156 阅读 · 0 评论 -
Learning projects lynda.com MERN
Ex_files_nodejs_expressjs (intro to express) Meetup app03_02Ex_files_advanced_express00_04Ex_files_databases_nodejs_dev (maxcoin & shopsy) I can't even run thisEx_fullstack_java...原创 2019-06-26 00:46:58 · 188 阅读 · 0 评论 -
Django
For now, we'll look at the role of each of theseas an overview and we'll deepenour understanding as needed later.First, the apps file controls settings specific to this app.The models file ...转载 2019-06-12 05:31:21 · 513 阅读 · 0 评论 -
MongoDB NodeJS (newer) (connect gets client containing db)
According to thechangelogfor 3.0 you now get a client object containing the database object instead:MongoClient.connect('mongodb://localhost:27017', (err, client) => { // Client returned...转载 2019-06-21 12:29:58 · 145 阅读 · 0 评论 -
MongoDB and NodeJS (some parts deprecated)
https://www.w3schools.com/nodejs/nodejs_mongodb.aspdbo.collection("tours").insertOne(myobj, callback) vsdb.collection("tours").insertOne(myobj, callback) [notice: url has database name or not)...转载 2019-06-21 02:21:18 · 143 阅读 · 0 评论 -
React
npm -install -g create-react-appnpm startLook at 02_03 for exercise back thenwhen you got a folder with package.json but without not json, run npm install to install dependency...转载 2019-06-05 05:36:53 · 144 阅读 · 0 评论 -
http PUT vs POST
https://restfulapi.net/rest-put-vs-post/REST – PUT vs POSTIt has been observed that many people struggle to choose betweenHTTP PUT vs POSTmethods when designing a system. Though,RFC 2616has...转载 2019-06-20 21:34:08 · 262 阅读 · 0 评论 -
Express and node.js
npm install -g npm@latest- [Instructor] Differently than with other web languages,like for instance PHP that runs as a module in Apache,Node.js comes with a web server built in.So Express is...转载 2019-06-11 03:45:52 · 368 阅读 · 0 评论 -
ECMAScript 6 - syntax
Let and alternative solution (nice example)<!DOCTYPE html><html><head> <style> section > div { height: 100px; width: 100px; background-color: red; float:...转载 2019-06-03 20:57:51 · 208 阅读 · 0 评论 -
MongoDB command line !!
(1) explore mongo shellmongodanother terminal: mongo>db>use learning_mongo // use learning_mongo as db>show dbs>db.cars.insert({"make": "subaru"}) // cars is collection, {"m...转载 2019-06-19 12:37:34 · 407 阅读 · 0 评论 -
MongoDB installation
-------------------------------------------------------------------------------------------------------------------------------------------------------------need node.jsthe following ...转载 2019-06-19 10:37:12 · 136 阅读 · 0 评论 -
Node js and express -- express generator
npm install -g --depth 0npm install -g express-generatorexpress -hexpress testprojectnpm installnpm startapp.js -- server/index.jslook at the routes folder-----------------------...转载 2019-06-19 06:57:28 · 152 阅读 · 0 评论 -
JS export modules - official docs + tut
express.RouterUse theexpress.Routerclass to create modular, mountable route handlers. ARouterinstance is a complete middleware and routing system; for this reason, it is often referred to as a “...转载 2019-06-18 20:24:24 · 210 阅读 · 0 评论 -
bootstrap - nav
navbar<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="widt...转载 2019-05-30 00:55:54 · 628 阅读 · 0 评论 -
node js
To run:node + file_name_wo_jsBasic setup:let hello = "Hello World From NODE JS";global.console.log(hello);The console object is actually a part of a global object.I could prefix this w...原创 2019-06-03 04:39:36 · 201 阅读 · 0 评论 -
Docker - get started
ref:https://docs.docker.com/machine/get-started/[Narrator] To get started with MongoDB,we first have to use Docker to downloadand run a container for it.Make sure that your Docker dae...转载 2019-06-23 08:24:52 · 471 阅读 · 0 评论 -
export default
This works:import {bar} from './foo';bar();// foo.jsmodule.exports = { bar() {}}And this works:import foo from './foo';foo.bar();// foo.jsexport default { bar() {}}So why doesn't...转载 2019-06-23 07:53:33 · 852 阅读 · 0 评论 -
delete cookies - chrome
原创 2019-07-27 02:48:00 · 575 阅读 · 0 评论 -
Update req.user in session
I am using PassportJS with ExpressJS.I need to update the logged in user details. While I do update this in the DB, how do I update it in the session too so that request.user contains the updated us...转载 2019-07-31 02:05:36 · 276 阅读 · 0 评论 -
bootstrap - navbar interactive
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Com...转载 2019-07-19 02:01:40 · 291 阅读 · 0 评论 -
MongoDB - name contest lynda.com
loadTestDataimport { MongoClient } from 'mongodb';import assert from 'assert';import config from './config';MongoClient.connect(config.mongodbUri, (err, db) => { assert.equal(null, err);...转载 2019-07-06 00:00:25 · 231 阅读 · 0 评论 -
Fetch data from remote api / server side - full stack mern lynda.com (part 2)
app/index.jsimport express from 'express';import data from '../src/testData';const router = express.Router();router.get('/contests', (req, res) => { res.send({ contests: data.contests });...转载 2019-06-30 23:22:52 · 156 阅读 · 0 评论 -
Learning Full stack (MERN) --- lynda.com (part 1)
React to run project:npm run dev (for webpack to generate bundle.js)npm startimport React from 'react';import ReactDOM from 'react-dom';const App = (props) => { return ( &l...转载 2019-06-30 21:34:22 · 358 阅读 · 0 评论 -
socket.io
index.jssocket: a socket declared in client, and it's listening to client eventio: this is the server(msg from index.html to index.js, and then to index.js)const app = require('express')...转载 2019-06-28 23:43:03 · 193 阅读 · 0 评论 -
socket.io express (intro)
index.jsconst app = require('express')();const server = require('http').Server(app);const io = require('socket.io')(server);const port = 3000;server.listen(port, () => { console.log(`S...转载 2019-06-28 23:25:31 · 130 阅读 · 0 评论 -
create a server in Nodejs and express
NodejsNow let's see how to use the http module as a server.After we import it we use the create server callto create a server, no surprise there,and then use the listen method to run the servero...转载 2019-06-28 14:31:23 · 137 阅读 · 0 评论 -
sample of .gitignore file
# Logslogs *.lognpm-debug.log*yarn-debug.log*yarn-error.log*.DS_Store# Runtime datapids*.pid*.seed*.pid.lock# Directory for instrumented libs generated by jscoverage/JSCoverlib-cov# C...转载 2019-07-09 09:22:44 · 163 阅读 · 0 评论 -
Using redis to implement a shopping basket
implementing basket using redisbin/www.js (so connectionis saved in config now and is globally available)#!/usr/bin/env node// Dependenciesconst http = require('http');const config = require...转载 2019-07-09 09:21:45 · 140 阅读 · 0 评论 -
Nodejs deployment and running in production
- [Narrator] As soon as your application is deployedto server and available to for real usersperformance becomes key, and this not only aboutthe user experience of individual users,but also cost eff...转载 2019-06-28 08:04:36 · 367 阅读 · 0 评论 -
max bitcoin value: mongoDB and request
// request is a module that makes http calls easierconst request = require('request');const MongoClient = require('mongodb').MongoClient;const dsn = "mongodb://192.168.99.100:37017";// Generic f...转载 2019-06-24 23:03:09 · 175 阅读 · 0 评论 -
MongoDB shell API vs MongoDB Nodejs driver API
insertOne as an example:shell: (Look under 'server' section)TheinsertOne()method has the following syntax:db.collection.insertOne( <document>, { writeConcern: <document&g...转载 2019-06-24 13:44:29 · 296 阅读 · 0 评论 -
Node js User authentication and file upload
bodyParserUser authenticationexpress-session:https://www.tutorialspoint.com/expressjs/expressjs_sessions.htmdocs:https://www.npmjs.com/package/express-session- [Instructor] Befo...转载 2019-06-28 06:56:44 · 257 阅读 · 0 评论 -
Installing webpack and webpack-CLI (2019.6 first edit, )
1.check version:node -vnpm -vThe tilde~matches the most recent patch version (the third number) for the specified minor version (the second number).~1.2.3 will match all 1.2.x versions but...原创 2019-06-02 02:52:21 · 259 阅读 · 0 评论 -
Babel
转载 2019-06-01 22:55:48 · 408 阅读 · 0 评论 -
npm package manager
npm init (this will generate a package.json)Install packages locally1. see 'import express from 'express'; =>npm install express(node modules folder is created, regular dependence inclu...原创 2019-06-01 21:32:10 · 633 阅读 · 0 评论 -
JS - parsing XML JSONusing AJAX
<!DOCTYPE html><html lang="en"><head> <meta charset="utf-8" /> <title>JavaScript AJAX</title></head><body><h1>AJAX page</h1><div...转载 2019-05-22 22:17:33 · 95 阅读 · 0 评论 -
JS - async
this syntax uses the async and await keywordsto enable writing asynchronous codethat closely resembles synchronous code patterns.For this reason, code using async and awaitis widely recognized a...转载 2019-05-27 02:55:05 · 808 阅读 · 0 评论 -
JS - promise.all
ThePromise.all()method returns a singlePromisethat resolves when all of the promises passed as an iterable have resolved or when the iterable contains no promises. It rejects with the reason of th...转载 2019-05-27 00:08:31 · 137 阅读 · 0 评论