initial commit
This commit is contained in:
Родитель
16a720ced2
Коммит
43a02fd1e2
|
@ -0,0 +1,30 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
|
||||
node_modules
|
||||
|
||||
# Debug log from npm
|
||||
npm-debug.log
|
|
@ -1,2 +0,0 @@
|
|||
# vscode-samples
|
||||
VS Code Samples
|
|
@ -0,0 +1,30 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
|
||||
node_modules
|
||||
|
||||
# Debug log from npm
|
||||
npm-debug.log
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"version": "0.1.0",
|
||||
// List of configurations. Add new configurations or edit existing ones.
|
||||
// ONLY "node" and "mono" are supported, change "type" to switch.
|
||||
"configurations": [
|
||||
{
|
||||
// Name of configuration; appears in the launch configuration drop down menu.
|
||||
"name": "Launch ./bin/www",
|
||||
// Type of configuration. Possible values: "node", "mono".
|
||||
"type": "node",
|
||||
// Workspace relative or absolute path to the program.
|
||||
"program": "./bin/www",
|
||||
// Automatically stop program after launch.
|
||||
"stopOnEntry": false,
|
||||
// Command line arguments passed to the program.
|
||||
"args": [],
|
||||
// Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
|
||||
"cwd": ".",
|
||||
// Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.
|
||||
"runtimeExecutable": null,
|
||||
// Optional arguments passed to the runtime executable.
|
||||
"runtimeArgs": [],
|
||||
// Environment variables passed to the program.
|
||||
"env": { },
|
||||
// Use JavaScript source maps (if they exist).
|
||||
"sourceMaps": false,
|
||||
// If JavaScript source maps are enabled, the generated code is expected in this directory.
|
||||
"outDir": null
|
||||
},
|
||||
{
|
||||
"name": "Debug Tests",
|
||||
"type": "node",
|
||||
// Notice, we bypass the launcher and start the test runner directly
|
||||
"program": "node_modules/mocha/bin/_mocha",
|
||||
"stopOnEntry": true,
|
||||
// run the tests in the tests folder
|
||||
"args": ["tests"],
|
||||
"cwd": ".",
|
||||
"runtimeExecutable": null,
|
||||
"env": { }
|
||||
},
|
||||
{
|
||||
"name": "Attach to running instance",
|
||||
"type": "node",
|
||||
// VS Code only supports 'localhost' at this time
|
||||
"address": "localhost",
|
||||
// Port to attach to, must match port in gulpfile.js
|
||||
"port": 5858
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
// Configure glob patterns for excluding files and folders.
|
||||
"files.exclude": {
|
||||
"**/.git": true,
|
||||
"**/.DS_Store": true
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"version": "0.1.0",
|
||||
"command": "gulp",
|
||||
"isShellCommand": true,
|
||||
"args": [
|
||||
"--no-color"
|
||||
],
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "test",
|
||||
"args": [],
|
||||
"isTestCommand": true
|
||||
},
|
||||
{
|
||||
"taskName": "less",
|
||||
"isBuildCommand": true,
|
||||
"problemMatcher": "$lessCompile"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
# README
|
||||
## This the readme for your application "node-express-javascript"
|
||||
-------------------
|
||||
### Visual Studio Code has *awesome* Markdown support!
|
||||
|
||||
* Split the editor (`Cmd+\` on OSX or `Ctrl+\` on Windows and Linux)
|
||||
* Toggle preview (`Shift+CMD+V` on OSX or `Shift+Ctrl+V` on Windows and Linux)
|
||||
* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (OSX) to see a list of Markdown snippets
|
||||
|
||||
### For more information
|
||||
* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
|
||||
* [Markdown Syntax Reference](http://daringfireball.net)
|
||||
|
||||
** Enjoy!**
|
|
@ -0,0 +1,61 @@
|
|||
var express = require('express');
|
||||
var path = require('path');
|
||||
var favicon = require('serve-favicon');
|
||||
var logger = require('morgan');
|
||||
var cookieParser = require('cookie-parser');
|
||||
var bodyParser = require('body-parser');
|
||||
|
||||
var routes = require('./routes/index');
|
||||
var users = require('./routes/users');
|
||||
|
||||
var app = express();
|
||||
|
||||
// view engine setup
|
||||
app.set('views', path.join(__dirname, 'views'));
|
||||
app.set('view engine', 'jade');
|
||||
|
||||
// uncomment after placing your favicon in /public
|
||||
//app.use(favicon(__dirname + '/public/favicon.ico'));
|
||||
app.use(logger('dev'));
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({ extended: false }));
|
||||
app.use(cookieParser());
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
app.use('/', routes);
|
||||
app.use('/users', users);
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function(req, res, next) {
|
||||
var err = new Error('Not Found');
|
||||
err.status = 404;
|
||||
next(err);
|
||||
});
|
||||
|
||||
// error handlers
|
||||
|
||||
// development error handler
|
||||
// will print stacktrace
|
||||
if (app.get('env') === 'development') {
|
||||
app.use(function(err, req, res, next) {
|
||||
res.status(err.status || 500);
|
||||
res.render('error', {
|
||||
message: err.message,
|
||||
error: err
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// production error handler
|
||||
// no stacktraces leaked to user
|
||||
app.use(function(err, req, res, next) {
|
||||
res.status(err.status || 500);
|
||||
res.render('error', {
|
||||
message: err.message,
|
||||
error: {}
|
||||
});
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
module.exports = app;
|
|
@ -0,0 +1,90 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var app = require('../app');
|
||||
var debug = require('debug')('node-express-javascript:server');
|
||||
var http = require('http');
|
||||
|
||||
/**
|
||||
* Get port from environment and store in Express.
|
||||
*/
|
||||
|
||||
var port = normalizePort(process.env.PORT || '3000');
|
||||
app.set('port', port);
|
||||
|
||||
/**
|
||||
* Create HTTP server.
|
||||
*/
|
||||
|
||||
var server = http.createServer(app);
|
||||
|
||||
/**
|
||||
* Listen on provided port, on all network interfaces.
|
||||
*/
|
||||
|
||||
server.listen(port);
|
||||
server.on('error', onError);
|
||||
server.on('listening', onListening);
|
||||
|
||||
/**
|
||||
* Normalize a port into a number, string, or false.
|
||||
*/
|
||||
|
||||
function normalizePort(val) {
|
||||
var port = parseInt(val, 10);
|
||||
|
||||
if (isNaN(port)) {
|
||||
// named pipe
|
||||
return val;
|
||||
}
|
||||
|
||||
if (port >= 0) {
|
||||
// port number
|
||||
return port;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "error" event.
|
||||
*/
|
||||
|
||||
function onError(error) {
|
||||
if (error.syscall !== 'listen') {
|
||||
throw error;
|
||||
}
|
||||
|
||||
var bind = typeof port === 'string'
|
||||
? 'Pipe ' + port
|
||||
: 'Port ' + port;
|
||||
|
||||
// handle specific listen errors with friendly messages
|
||||
switch (error.code) {
|
||||
case 'EACCES':
|
||||
console.error(bind + ' requires elevated privileges');
|
||||
process.exit(1);
|
||||
break;
|
||||
case 'EADDRINUSE':
|
||||
console.error(bind + ' is already in use');
|
||||
process.exit(1);
|
||||
break;
|
||||
default:
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "listening" event.
|
||||
*/
|
||||
|
||||
function onListening() {
|
||||
var addr = server.address();
|
||||
var bind = typeof addr === 'string'
|
||||
? 'pipe ' + addr
|
||||
: 'port ' + addr.port;
|
||||
console.log('Listening on ' + bind);
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
var gulp = require('gulp');
|
||||
var less = require('gulp-less');
|
||||
var path = require('path');
|
||||
var mocha = require('gulp-mocha');
|
||||
var browserSync = require('browser-sync');
|
||||
var nodemon = require('gulp-nodemon');
|
||||
|
||||
|
||||
/**
|
||||
* watch for any LESS file changes
|
||||
* if a file change is detected, run the LESS compile gulp task
|
||||
*/
|
||||
gulp.task('watch', function() {
|
||||
gulp.watch('styles/**/*.less', ['less']);
|
||||
});
|
||||
|
||||
/**
|
||||
* compile less files from the ./styles folder
|
||||
* into css files to the ./public/stylesheets folder
|
||||
*/
|
||||
gulp.task('less', function () {
|
||||
return gulp.src('./styles/**/*.less')
|
||||
.pipe(less({
|
||||
paths: [path.join(__dirname, 'less', 'includes')]
|
||||
}))
|
||||
.pipe(gulp.dest('./public/stylesheets'));
|
||||
});
|
||||
|
||||
/**
|
||||
* run mocha tests in the ./tests folder
|
||||
*/
|
||||
gulp.task('test', function () {
|
||||
return gulp.src('./tests/test*.js', { read: false })
|
||||
// gulp-mocha needs filepaths so you can't have any plugins before it
|
||||
.pipe(mocha());
|
||||
});
|
||||
|
||||
/**
|
||||
* run browser-sync on for client changes
|
||||
*/
|
||||
gulp.task('browser-sync', ['nodemon', 'watch'], function () {
|
||||
browserSync.init(null, {
|
||||
proxy: "http://localhost:3000",
|
||||
files: ["public/**/*.*", "views/**/*.*"],
|
||||
browser: "google chrome",
|
||||
port: 7000,
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* run nodemon on server file changes
|
||||
*/
|
||||
gulp.task('nodemon', function (cb) {
|
||||
var started = false;
|
||||
|
||||
return nodemon({
|
||||
script: 'bin/www',
|
||||
watch: ['bin/www', '*.js']
|
||||
}).on('start', function () {
|
||||
if (!started) {
|
||||
cb();
|
||||
started = true;
|
||||
}
|
||||
}).on('restart', function onRestart() {
|
||||
setTimeout(function reload() {
|
||||
browserSync.reload({
|
||||
stream: false
|
||||
});
|
||||
}, 500); // browserSync reload delay
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('default', ['browser-sync']);
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES5",
|
||||
"module": "commonjs"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "node-express-javascript",
|
||||
"description": "node-express-javascript Sample Application (JavaScript)",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node ./bin/www",
|
||||
"test": "mocha ./tests/test.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"body-parser": "~1.12.0",
|
||||
"cookie-parser": "~1.3.4",
|
||||
"debug": "~2.1.1",
|
||||
"express": "~4.12.2",
|
||||
"jade": "~1.9.2",
|
||||
"less-middleware": "1.0.x",
|
||||
"morgan": "~1.5.1",
|
||||
"serve-favicon": "~2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browser-sync": "^2.8.2",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-less": "^3.0.3",
|
||||
"gulp-mocha": "^2.1.2",
|
||||
"gulp-nodemon": "^2.0.3",
|
||||
"marked": "^0.3.5",
|
||||
"mocha": "^2.2.5",
|
||||
"nodemon": "^1.4.0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
body {
|
||||
padding: 50px;
|
||||
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
a {
|
||||
color: #00b7ff;
|
||||
}
|
||||
.blocktext {
|
||||
font-family: Courier New, Courier, monospace;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
/* GET home page. */
|
||||
router.get('/', function(req, res, next) {
|
||||
res.render('index', { title: 'Visual Studio Code!' });
|
||||
});
|
||||
|
||||
/* GET Quick Start. */
|
||||
router.get('/quickstart', function(req, res, next) {
|
||||
res.render('quickstart');
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -0,0 +1,9 @@
|
|||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
/* GET users listing. */
|
||||
router.get('/', function(req, res, next) {
|
||||
res.send('respond with a resource');
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -0,0 +1,14 @@
|
|||
@linkcolor: #00B7FF;
|
||||
|
||||
body {
|
||||
padding: 50px;
|
||||
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: @linkcolor
|
||||
}
|
||||
|
||||
.blocktext {
|
||||
font-family: Courier New, Courier, monospace;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
var assert = require("assert");
|
||||
|
||||
describe('Array', function(){
|
||||
describe('#indexOf()', function(){
|
||||
it('should return -1 when the value is not present', function(){
|
||||
assert.equal(-1, [1,2,3].indexOf(5));
|
||||
assert.equal(-1, [1,2,3].indexOf(0));
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"version": "v4",
|
||||
"repo": "borisyankov/DefinitelyTyped",
|
||||
"ref": "master",
|
||||
"path": "typings",
|
||||
"bundle": "typings/tsd.d.ts",
|
||||
"installed": {
|
||||
"express/express.d.ts": {
|
||||
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
|
||||
},
|
||||
"node/node.d.ts": {
|
||||
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
|
||||
},
|
||||
"serve-favicon/serve-favicon.d.ts": {
|
||||
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
|
||||
},
|
||||
"morgan/morgan.d.ts": {
|
||||
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
|
||||
},
|
||||
"cookie-parser/cookie-parser.d.ts": {
|
||||
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
|
||||
},
|
||||
"body-parser/body-parser.d.ts": {
|
||||
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
|
||||
},
|
||||
"debug/debug.d.ts": {
|
||||
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
|
||||
},
|
||||
"mocha/mocha.d.ts": {
|
||||
"commit": "983126e131a2b81739053d60e4bbdbb46d6577b7"
|
||||
},
|
||||
"gulp/gulp.d.ts": {
|
||||
"commit": "3d2916191781fe400176a030c03722ac4b87f1c1"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
// Type definitions for body-parser
|
||||
// Project: http://expressjs.com
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo/>, VILIC VANE <https://vilic.info>, Jonathan Häberle <https://github.com/dreampulse/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module "body-parser" {
|
||||
import express = require('express');
|
||||
|
||||
/**
|
||||
* bodyParser: use individual json/urlencoded middlewares
|
||||
* @deprecated
|
||||
*/
|
||||
|
||||
function bodyParser(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* only parse objects and arrays. (default: true)
|
||||
*/
|
||||
strict?: boolean;
|
||||
/**
|
||||
* passed to JSON.parse().
|
||||
*/
|
||||
receiver?: (key: string, value: any) => any;
|
||||
/**
|
||||
* parse extended syntax with the qs module. (default: true)
|
||||
*/
|
||||
extended?: boolean;
|
||||
}): express.RequestHandler;
|
||||
|
||||
module bodyParser {
|
||||
export function json(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'json')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* only parse objects and arrays. (default: true)
|
||||
*/
|
||||
strict?: boolean;
|
||||
/**
|
||||
* passed to JSON.parse().
|
||||
*/
|
||||
receiver?: (key: string, value: any) => any;
|
||||
}): express.RequestHandler;
|
||||
|
||||
export function raw(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'application/octet-stream')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
}): express.RequestHandler;
|
||||
|
||||
export function text(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'text/plain')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* the default charset to parse as, if not specified in content-type. (default: 'utf-8')
|
||||
*/
|
||||
defaultCharset?: string;
|
||||
}): express.RequestHandler;
|
||||
|
||||
export function urlencoded(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'urlencoded')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* parse extended syntax with the qs module. (default: true)
|
||||
*/
|
||||
extended?: boolean;
|
||||
}): express.RequestHandler;
|
||||
}
|
||||
|
||||
export = bodyParser;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
// Type definitions for cookie-parser
|
||||
// Project: https://github.com/expressjs/cookie-parser
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module "cookie-parser" {
|
||||
import express = require('express');
|
||||
function e(secret?: string, options?: any): express.RequestHandler;
|
||||
export = e;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
// Type definitions for debug
|
||||
// Project: https://github.com/visionmedia/debug
|
||||
// Definitions by: Seon-Wook Park <https://github.com/swook>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "debug" {
|
||||
|
||||
function d(namespace: string): d.Debugger;
|
||||
|
||||
module d {
|
||||
export var log: Function;
|
||||
|
||||
function enable(namespaces: string): void;
|
||||
function disable(): void;
|
||||
|
||||
function enabled(namespace: string): boolean;
|
||||
|
||||
export interface Debugger {
|
||||
(formatter: any, ...args: any[]): void;
|
||||
|
||||
enabled: boolean;
|
||||
log: Function;
|
||||
namespace: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = d;
|
||||
|
||||
}
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,264 @@
|
|||
// Type definitions for Gulp v3.8.x
|
||||
// Project: http://gulpjs.com
|
||||
// Definitions by: Drew Noakes <https://drewnoakes.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module gulp {
|
||||
|
||||
/**
|
||||
* Options to pass to node-glob through glob-stream.
|
||||
* Specifies two options in addition to those used by node-glob:
|
||||
* https://github.com/isaacs/node-glob#options
|
||||
*/
|
||||
interface ISrcOptions {
|
||||
/**
|
||||
* Setting this to <code>false</code> will return <code>file.contents</code> as <code>null</code>
|
||||
* and not read the file at all.
|
||||
* Default: <code>true</code>.
|
||||
*/
|
||||
read?: boolean;
|
||||
|
||||
/**
|
||||
* Setting this to false will return <code>file.contents</code> as a stream and not buffer files.
|
||||
* This is useful when working with large files.
|
||||
* Note: Plugins might not implement support for streams.
|
||||
* Default: <code>true</code>.
|
||||
*/
|
||||
buffer?: boolean;
|
||||
|
||||
/**
|
||||
* The current working directory in which to search.
|
||||
* Defaults to process.cwd().
|
||||
*/
|
||||
cwd?: string;
|
||||
|
||||
/**
|
||||
* The place where patterns starting with / will be mounted onto.
|
||||
* Defaults to path.resolve(options.cwd, "/") (/ on Unix systems, and C:\ or some such on Windows.)
|
||||
*/
|
||||
root?: string;
|
||||
|
||||
/**
|
||||
* Include .dot files in normal matches and globstar matches.
|
||||
* Note that an explicit dot in a portion of the pattern will always match dot files.
|
||||
*/
|
||||
dot?: boolean;
|
||||
|
||||
/**
|
||||
* By default, a pattern starting with a forward-slash will be "mounted" onto the root setting, so that a valid
|
||||
* filesystem path is returned. Set this flag to disable that behavior.
|
||||
*/
|
||||
nomount?: boolean;
|
||||
|
||||
/**
|
||||
* Add a / character to directory matches. Note that this requires additional stat calls.
|
||||
*/
|
||||
mark?: boolean;
|
||||
|
||||
/**
|
||||
* Don't sort the results.
|
||||
*/
|
||||
nosort?: boolean;
|
||||
|
||||
/**
|
||||
* Set to true to stat all results. This reduces performance somewhat, and is completely unnecessary, unless
|
||||
* readdir is presumed to be an untrustworthy indicator of file existence. It will cause ELOOP to be triggered one
|
||||
* level sooner in the case of cyclical symbolic links.
|
||||
*/
|
||||
stat?: boolean;
|
||||
|
||||
/**
|
||||
* When an unusual error is encountered when attempting to read a directory, a warning will be printed to stderr.
|
||||
* Set the silent option to true to suppress these warnings.
|
||||
*/
|
||||
silent?: boolean;
|
||||
|
||||
/**
|
||||
* When an unusual error is encountered when attempting to read a directory, the process will just continue on in
|
||||
* search of other matches. Set the strict option to raise an error in these cases.
|
||||
*/
|
||||
strict?: boolean;
|
||||
|
||||
/**
|
||||
* See cache property above. Pass in a previously generated cache object to save some fs calls.
|
||||
*/
|
||||
cache?: boolean;
|
||||
|
||||
/**
|
||||
* A cache of results of filesystem information, to prevent unnecessary stat calls.
|
||||
* While it should not normally be necessary to set this, you may pass the statCache from one glob() call to the
|
||||
* options object of another, if you know that the filesystem will not change between calls.
|
||||
*/
|
||||
statCache?: boolean;
|
||||
|
||||
/**
|
||||
* Perform a synchronous glob search.
|
||||
*/
|
||||
sync?: boolean;
|
||||
|
||||
/**
|
||||
* In some cases, brace-expanded patterns can result in the same file showing up multiple times in the result set.
|
||||
* By default, this implementation prevents duplicates in the result set. Set this flag to disable that behavior.
|
||||
*/
|
||||
nounique?: boolean;
|
||||
|
||||
/**
|
||||
* Set to never return an empty set, instead returning a set containing the pattern itself.
|
||||
* This is the default in glob(3).
|
||||
*/
|
||||
nonull?: boolean;
|
||||
|
||||
/**
|
||||
* Perform a case-insensitive match. Note that case-insensitive filesystems will sometimes result in glob returning
|
||||
* results that are case-insensitively matched anyway, since readdir and stat will not raise an error.
|
||||
*/
|
||||
nocase?: boolean;
|
||||
|
||||
/**
|
||||
* Set to enable debug logging in minimatch and glob.
|
||||
*/
|
||||
debug?: boolean;
|
||||
|
||||
/**
|
||||
* Set to enable debug logging in glob, but not minimatch.
|
||||
*/
|
||||
globDebug?: boolean;
|
||||
}
|
||||
|
||||
interface IDestOptions {
|
||||
/**
|
||||
* The output folder. Only has an effect if provided output folder is relative.
|
||||
* Default: process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
|
||||
/**
|
||||
* Octal permission string specifying mode for any folders that need to be created for output folder.
|
||||
* Default: 0777.
|
||||
*/
|
||||
mode?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options that are passed to <code>gaze</code>.
|
||||
* https://github.com/shama/gaze
|
||||
*/
|
||||
interface IWatchOptions {
|
||||
/** Interval to pass to fs.watchFile. */
|
||||
interval?: number;
|
||||
/** Delay for events called in succession for the same file/event. */
|
||||
debounceDelay?: number;
|
||||
/** Force the watch mode. Either 'auto' (default), 'watch' (force native events), or 'poll' (force stat polling). */
|
||||
mode?: string;
|
||||
/** The current working directory to base file patterns from. Default is process.cwd().. */
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
interface IWatchEvent {
|
||||
/** The type of change that occurred, either added, changed or deleted. */
|
||||
type: string;
|
||||
/** The path to the file that triggered the event. */
|
||||
path: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to be called on each watched file change.
|
||||
*/
|
||||
interface IWatchCallback {
|
||||
(event:IWatchEvent): void;
|
||||
}
|
||||
|
||||
interface ITaskCallback {
|
||||
/**
|
||||
* Defines a task.
|
||||
* Tasks may be made asynchronous if they are passing a callback or return a promise or a stream.
|
||||
* @param cb callback used to signal asynchronous completion. Caller includes <code>err</code> in case of error.
|
||||
*/
|
||||
(cb?:(err?:any)=>void): any;
|
||||
}
|
||||
|
||||
interface EventEmitter {
|
||||
any: any;
|
||||
}
|
||||
|
||||
interface Gulp {
|
||||
/**
|
||||
* Define a task.
|
||||
*
|
||||
* @param name the name of the task. Tasks that you want to run from the command line should not have spaces in them.
|
||||
* @param fn the function that performs the task's operations. Generally this takes the form of gulp.src().pipe(someplugin()).
|
||||
*/
|
||||
task(name:string, fn:ITaskCallback): any;
|
||||
|
||||
/**
|
||||
* Define a task.
|
||||
*
|
||||
* @param name the name of the task. Tasks that you want to run from the command line should not have spaces in them.
|
||||
* @param dep an array of tasks to be executed and completed before your task will run.
|
||||
* @param fn the function that performs the task's operations. Generally this takes the form of gulp.src().pipe(someplugin()).
|
||||
*/
|
||||
task(name:string, dep:string[], fn?:ITaskCallback): any;
|
||||
|
||||
|
||||
/**
|
||||
* Takes a glob and represents a file structure. Can be piped to plugins.
|
||||
* @param glob a glob string, using node-glob syntax
|
||||
* @param opt an optional option object
|
||||
*/
|
||||
src(glob:string, opt?:ISrcOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
/**
|
||||
* Takes a glob and represents a file structure. Can be piped to plugins.
|
||||
* @param glob an array of glob strings, using node-glob syntax
|
||||
* @param opt an optional option object
|
||||
*/
|
||||
src(glob:string[], opt?:ISrcOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
|
||||
/**
|
||||
* Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders.
|
||||
* Folders that don't exist will be created.
|
||||
*
|
||||
* @param outFolder the path (output folder) to write files to.
|
||||
* @param opt
|
||||
*/
|
||||
dest(outFolder:string, opt?:IDestOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
/**
|
||||
* Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders.
|
||||
* Folders that don't exist will be created.
|
||||
*
|
||||
* @param outFolder a function that converts a vinyl File instance into an output path
|
||||
* @param opt
|
||||
*/
|
||||
dest(outFolder:(file:string)=>string, opt?:IDestOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
|
||||
/**
|
||||
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
|
||||
*
|
||||
* @param glob a single glob or array of globs that indicate which files to watch for changes.
|
||||
* @param opt options, that are passed to the gaze library.
|
||||
* @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with gulp.task().
|
||||
*/
|
||||
watch(glob:string, fn:(IWatchCallback|string)): EventEmitter;
|
||||
watch(glob:string, fn:(IWatchCallback|string)[]): EventEmitter;
|
||||
watch(glob:string, opt:IWatchOptions, fn:(IWatchCallback|string)): EventEmitter;
|
||||
watch(glob:string, opt:IWatchOptions, fn:(IWatchCallback|string)[]): EventEmitter;
|
||||
watch(glob:string[], fn:(IWatchCallback|string)): EventEmitter;
|
||||
watch(glob:string[], fn:(IWatchCallback|string)[]): EventEmitter;
|
||||
watch(glob:string[], opt:IWatchOptions, fn:(IWatchCallback|string)): EventEmitter;
|
||||
watch(glob:string[], opt:IWatchOptions, fn:(IWatchCallback|string)[]): EventEmitter;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "gulp" {
|
||||
var _tmp:gulp.Gulp;
|
||||
export = _tmp;
|
||||
}
|
||||
|
||||
interface IGulpPlugin {
|
||||
(...args: any[]): NodeJS.ReadWriteStream;
|
||||
}
|
|
@ -0,0 +1,214 @@
|
|||
// Type definitions for mocha 2.2.5
|
||||
// Project: http://mochajs.org/
|
||||
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>, otiai10 <https://github.com/otiai10>, jt000 <https://github.com/jt000>, Vadim Macagon <https://github.com/enlight>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface MochaSetupOptions {
|
||||
//milliseconds to wait before considering a test slow
|
||||
slow?: number;
|
||||
|
||||
// timeout in milliseconds
|
||||
timeout?: number;
|
||||
|
||||
// ui name "bdd", "tdd", "exports" etc
|
||||
ui?: string;
|
||||
|
||||
//array of accepted globals
|
||||
globals?: any[];
|
||||
|
||||
// reporter instance (function or string), defaults to `mocha.reporters.Spec`
|
||||
reporter?: any;
|
||||
|
||||
// bail on the first test failure
|
||||
bail?: boolean;
|
||||
|
||||
// ignore global leaks
|
||||
ignoreLeaks?: boolean;
|
||||
|
||||
// grep string or regexp to filter tests with
|
||||
grep?: any;
|
||||
}
|
||||
|
||||
interface MochaDone {
|
||||
(error?: Error): void;
|
||||
}
|
||||
|
||||
declare var mocha: Mocha;
|
||||
declare var describe: Mocha.IContextDefinition;
|
||||
declare var xdescribe: Mocha.IContextDefinition;
|
||||
// alias for `describe`
|
||||
declare var context: Mocha.IContextDefinition;
|
||||
// alias for `describe`
|
||||
declare var suite: Mocha.IContextDefinition;
|
||||
declare var it: Mocha.ITestDefinition;
|
||||
declare var xit: Mocha.ITestDefinition;
|
||||
// alias for `it`
|
||||
declare var test: Mocha.ITestDefinition;
|
||||
|
||||
declare function before(action: () => void): void;
|
||||
|
||||
declare function before(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function setup(action: () => void): void;
|
||||
|
||||
declare function setup(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function after(action: () => void): void;
|
||||
|
||||
declare function after(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function teardown(action: () => void): void;
|
||||
|
||||
declare function teardown(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function beforeEach(action: () => void): void;
|
||||
|
||||
declare function beforeEach(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function suiteSetup(action: () => void): void;
|
||||
|
||||
declare function suiteSetup(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function afterEach(action: () => void): void;
|
||||
|
||||
declare function afterEach(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function suiteTeardown(action: () => void): void;
|
||||
|
||||
declare function suiteTeardown(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare class Mocha {
|
||||
constructor(options?: {
|
||||
grep?: RegExp;
|
||||
ui?: string;
|
||||
reporter?: string;
|
||||
timeout?: number;
|
||||
bail?: boolean;
|
||||
});
|
||||
|
||||
/** Setup mocha with the given options. */
|
||||
setup(options: MochaSetupOptions): Mocha;
|
||||
bail(value?: boolean): Mocha;
|
||||
addFile(file: string): Mocha;
|
||||
/** Sets reporter by name, defaults to "spec". */
|
||||
reporter(name: string): Mocha;
|
||||
/** Sets reporter constructor, defaults to mocha.reporters.Spec. */
|
||||
reporter(reporter: (runner: Mocha.IRunner, options: any) => any): Mocha;
|
||||
ui(value: string): Mocha;
|
||||
grep(value: string): Mocha;
|
||||
grep(value: RegExp): Mocha;
|
||||
invert(): Mocha;
|
||||
ignoreLeaks(value: boolean): Mocha;
|
||||
checkLeaks(): Mocha;
|
||||
/** Enables growl support. */
|
||||
growl(): Mocha;
|
||||
globals(value: string): Mocha;
|
||||
globals(values: string[]): Mocha;
|
||||
useColors(value: boolean): Mocha;
|
||||
useInlineDiffs(value: boolean): Mocha;
|
||||
timeout(value: number): Mocha;
|
||||
slow(value: number): Mocha;
|
||||
enableTimeouts(value: boolean): Mocha;
|
||||
asyncOnly(value: boolean): Mocha;
|
||||
noHighlighting(value: boolean): Mocha;
|
||||
/** Runs tests and invokes `onComplete()` when finished. */
|
||||
run(onComplete?: (failures: number) => void): Mocha.IRunner;
|
||||
}
|
||||
|
||||
// merge the Mocha class declaration with a module
|
||||
declare module Mocha {
|
||||
/** Partial interface for Mocha's `Runnable` class. */
|
||||
interface IRunnable {
|
||||
title: string;
|
||||
fn: Function;
|
||||
async: boolean;
|
||||
sync: boolean;
|
||||
timedOut: boolean;
|
||||
}
|
||||
|
||||
/** Partial interface for Mocha's `Suite` class. */
|
||||
interface ISuite {
|
||||
parent: ISuite;
|
||||
title: string;
|
||||
|
||||
fullTitle(): string;
|
||||
}
|
||||
|
||||
/** Partial interface for Mocha's `Test` class. */
|
||||
interface ITest extends IRunnable {
|
||||
parent: ISuite;
|
||||
pending: boolean;
|
||||
|
||||
fullTitle(): string;
|
||||
}
|
||||
|
||||
/** Partial interface for Mocha's `Runner` class. */
|
||||
interface IRunner {}
|
||||
|
||||
interface IContextDefinition {
|
||||
(description: string, spec: () => void): ISuite;
|
||||
only(description: string, spec: () => void): ISuite;
|
||||
skip(description: string, spec: () => void): void;
|
||||
timeout(ms: number): void;
|
||||
}
|
||||
|
||||
interface ITestDefinition {
|
||||
(expectation: string, assertion?: () => void): ITest;
|
||||
(expectation: string, assertion?: (done: MochaDone) => void): ITest;
|
||||
only(expectation: string, assertion?: () => void): ITest;
|
||||
only(expectation: string, assertion?: (done: MochaDone) => void): ITest;
|
||||
skip(expectation: string, assertion?: () => void): void;
|
||||
skip(expectation: string, assertion?: (done: MochaDone) => void): void;
|
||||
timeout(ms: number): void;
|
||||
}
|
||||
|
||||
export module reporters {
|
||||
export class Base {
|
||||
stats: {
|
||||
suites: number;
|
||||
tests: number;
|
||||
passes: number;
|
||||
pending: number;
|
||||
failures: number;
|
||||
};
|
||||
|
||||
constructor(runner: IRunner);
|
||||
}
|
||||
|
||||
export class Doc extends Base {}
|
||||
export class Dot extends Base {}
|
||||
export class HTML extends Base {}
|
||||
export class HTMLCov extends Base {}
|
||||
export class JSON extends Base {}
|
||||
export class JSONCov extends Base {}
|
||||
export class JSONStream extends Base {}
|
||||
export class Landing extends Base {}
|
||||
export class List extends Base {}
|
||||
export class Markdown extends Base {}
|
||||
export class Min extends Base {}
|
||||
export class Nyan extends Base {}
|
||||
export class Progress extends Base {
|
||||
/**
|
||||
* @param options.open String used to indicate the start of the progress bar.
|
||||
* @param options.complete String used to indicate a complete test on the progress bar.
|
||||
* @param options.incomplete String used to indicate an incomplete test on the progress bar.
|
||||
* @param options.close String used to indicate the end of the progress bar.
|
||||
*/
|
||||
constructor(runner: IRunner, options?: {
|
||||
open?: string;
|
||||
complete?: string;
|
||||
incomplete?: string;
|
||||
close?: string;
|
||||
});
|
||||
}
|
||||
export class Spec extends Base {}
|
||||
export class TAP extends Base {}
|
||||
export class XUnit extends Base {
|
||||
constructor(runner: IRunner, options?: any);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "mocha" {
|
||||
export = Mocha;
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
// Type definitions for morgan 1.2.2
|
||||
// Project: https://github.com/expressjs/morgan
|
||||
// Definitions by: James Roland Cabresos <https://github.com/staticfunction>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
declare module "morgan" {
|
||||
|
||||
import express = require('express');
|
||||
|
||||
module morgan {
|
||||
|
||||
export function token<T>(name: string, callback: (req: express.Request, res: express.Response) => T): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Morgan accepts these properties in the options object.
|
||||
*/
|
||||
export interface Options {
|
||||
|
||||
/***
|
||||
* Buffer duration before writing logs to the stream, defaults to false. When set to true, defaults to 1000 ms.
|
||||
*/
|
||||
buffer?: boolean;
|
||||
|
||||
/***
|
||||
* Write log line on request instead of response. This means that a requests will be logged even if the server crashes, but data from the response cannot be logged (like the response code).
|
||||
*/
|
||||
immediate?: boolean;
|
||||
|
||||
/***
|
||||
* Function to determine if logging is skipped, defaults to false. This function will be called as skip(req, res).
|
||||
*/
|
||||
skip?: (req: express.Request, res: express.Response) => boolean;
|
||||
|
||||
/***
|
||||
* Output stream for writing log lines, defaults to process.stdout.
|
||||
* @param str
|
||||
*/
|
||||
stream?: (str: string) => void;
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* Create a new morgan logger middleware function using the given format and options. The format argument may be a string of a predefined name (see below for the names), a string of a format string, or a function that will produce a log entry.
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: string, options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Standard Apache combined log output.
|
||||
* :remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: 'combined', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Standard Apache common log output.
|
||||
* :remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length]
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: 'common', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Concise output colored by response status for development use. The :status token will be colored red for server error codes, yellow for client error codes, cyan for redirection codes, and uncolored for all other codes.
|
||||
* :method :url :status :response-time ms - :res[content-length]
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: 'dev', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Shorter than default, also including response time.
|
||||
* :remote-addr :remote-user :method :url HTTP/:http-version :status :res[content-length] - :response-time ms
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: 'short', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* The minimal output.
|
||||
* :method :url :status :res[content-length] - :response-time ms
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: 'tiny', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
function morgan(custom: (req: express.Request, res: express.Response) => string): express.RequestHandler
|
||||
|
||||
export = morgan;
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,29 @@
|
|||
// Type definitions for serve-favicon 2.1.6
|
||||
// Project: https://github.com/expressjs/serve-favicon
|
||||
// Definitions by: Uros Smolnik <https://github.com/urossmolnik/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/* =================== USAGE ===================
|
||||
|
||||
import serveFavicon = require('serve-favicon');
|
||||
app.use(serveFavicon(__dirname + '/public/favicon.ico'));
|
||||
|
||||
=============================================== */
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module "serve-favicon" {
|
||||
import express = require('express');
|
||||
|
||||
/**
|
||||
* Node.js middleware for serving a favicon.
|
||||
*/
|
||||
function serveFavicon(path: string, options?: {
|
||||
/**
|
||||
* The cache-control max-age directive in ms, defaulting to 1 day. This can also be a string accepted by the ms module.
|
||||
*/
|
||||
maxAge?: number;
|
||||
}): express.RequestHandler;
|
||||
|
||||
export = serveFavicon;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
/// <reference path="body-parser/body-parser.d.ts" />
|
||||
/// <reference path="cookie-parser/cookie-parser.d.ts" />
|
||||
/// <reference path="debug/debug.d.ts" />
|
||||
/// <reference path="express/express.d.ts" />
|
||||
/// <reference path="morgan/morgan.d.ts" />
|
||||
/// <reference path="node/node.d.ts" />
|
||||
/// <reference path="serve-favicon/serve-favicon.d.ts" />
|
||||
/// <reference path="mocha/mocha.d.ts" />
|
||||
/// <reference path="gulp/gulp.d.ts" />
|
|
@ -0,0 +1,6 @@
|
|||
extends layout
|
||||
|
||||
block content
|
||||
h1= message
|
||||
h2= error.status
|
||||
pre #{error.stack}
|
|
@ -0,0 +1,9 @@
|
|||
extends layout
|
||||
|
||||
block content
|
||||
h1 Visual Studio Code - Starter Express Application (JavaScript)
|
||||
p Welcome to #{title}
|
||||
|
||||
| For more information, please see the
|
||||
a(href='/quickstart') Quick Start
|
||||
|.
|
|
@ -0,0 +1,7 @@
|
|||
doctype html
|
||||
html
|
||||
head
|
||||
title= title
|
||||
link(rel='stylesheet', href='/stylesheets/style.css')
|
||||
body
|
||||
block content
|
|
@ -0,0 +1,4 @@
|
|||
extends layout
|
||||
|
||||
block content
|
||||
include:md ../vscodequickstart.md
|
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
Press Ctrl+Shift+V (Windows, Linux) or Cmd+Shift+V (OSX) to preview this document!
|
||||
-->
|
||||
|
||||
# Getting Started with Node, Express and Visual Studio Code
|
||||
This is an [express-generator](http://expressjs.com/starter/generator.html) generated sample customized for development using [Visual Studio Code](http://code.visualstudio.com).
|
||||
|
||||
This example illustrates:
|
||||
- **Great IntelliSense**: [TypeScript definition files](https://github.com/borisyankov/DefinitelyTyped) provide IntelliSense for Node, Express, Mocha, and Gulp. Use [tsd](http://definitelytyped.org/tsd/) to install additional typings.
|
||||
|
||||
- **Iterative Development**: Use [BrowserSync](http://www.browsersync.io/) and [NodeMon](http://nodemon.io/) to automatically recycle your client and server while developing in Visual Studio Code. Run `gulp browser-sync` from the Terminal.
|
||||
|
||||
- **Test**: [Mocha](http://mochajs.org/) is a popular test framework for Node applications. Press `Ctrl+Shift+T` (Windows, Linux) or `Cmd+Shift+T` (OS X) to run the tests.
|
||||
|
||||
- **StyleSheets**: [LESS](http://lesscss.org/) is a CSS pre-processor that extends CSS to allow for typical programming construcs such as variables, mixins, and functions. To compile your .less file to .css press `Ctrl+Shift+B` (Windows, Linux) or `Cmd+Shift+B` (OS X).
|
||||
|
||||
- **Debugging**: [Launch Configurations](https://code.visualstudio.com/Docs/debugging) are used for running your application under the debugger as well as launching the Mocha tests under the debugger. Open the Debug viewlet, select `Launch ./bin/www` and press `F5` to run the application.
|
||||
|
||||
- **Integration with existing tools**: [Task Configurations](https://code.visualstudio.com/Docs/tasks) allow for control over how individual [Gulp](http://gulpjs.com/) tasks are launched. Run individual tasks from the Command Palette by pressing `Ctrl+P` (Windows, Linux) or `Cmd+P` (OS X), type in `task` and then press `space` to see all of the tasks in the provided `gulpfile.js`.
|
||||
|
||||
For more information, please visit us at [code.visualstudio.com](http://code.visualstudio.com), read the [documentation](http://code.visualstudio.com/docs) and follow us on twitter [@code](https://twitter.com/code).
|
|
@ -0,0 +1,30 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
|
||||
node_modules
|
||||
|
||||
# Debug log from npm
|
||||
npm-debug.log
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
"version": "0.1.0",
|
||||
// List of configurations. Add new configurations or edit existing ones.
|
||||
// ONLY "node" and "mono" are supported, change "type" to switch.
|
||||
"configurations": [
|
||||
{
|
||||
// Name of configuration; appears in the launch configuration drop down menu.
|
||||
"name": "Launch ./src/www.js",
|
||||
// Type of configuration. Possible values: "node", "mono".
|
||||
"type": "node",
|
||||
// Workspace relative or absolute path to the program.
|
||||
"program": "./src/www.js",
|
||||
// Automatically stop program after launch.
|
||||
"stopOnEntry": false,
|
||||
// Command line arguments passed to the program.
|
||||
"args": [],
|
||||
// Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
|
||||
"cwd": ".",
|
||||
// Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.
|
||||
"runtimeExecutable": null,
|
||||
// Optional arguments passed to the runtime executable.
|
||||
"runtimeArgs": [],
|
||||
// Environment variables passed to the program.
|
||||
"env": { },
|
||||
// Use JavaScript source maps (if they exist).
|
||||
"sourceMaps": true,
|
||||
// If JavaScript source maps are enabled, the generated code is expected in this directory.
|
||||
"outDir": "./src"
|
||||
},
|
||||
{
|
||||
"name": "Debug Tests",
|
||||
"type": "node",
|
||||
// Notice, we bypass the launcher and start the test runner directly
|
||||
"program": "node_modules/mocha/bin/_mocha",
|
||||
"stopOnEntry": false,
|
||||
// run the tests in the tests folder
|
||||
"args": ["tests"],
|
||||
"cwd": ".",
|
||||
"runtimeExecutable": null,
|
||||
"env": { },
|
||||
"sourceMaps": true,
|
||||
"outDir": "./tests"
|
||||
},
|
||||
{
|
||||
"name": "Attach to running instance",
|
||||
"type": "node",
|
||||
// VS Code only supports 'localhost' at this time
|
||||
"address": "localhost",
|
||||
// Port to attach to, must match port in gulpfile.js
|
||||
"port": 5858
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
// Configure glob patterns for excluding files and folders.
|
||||
"files.exclude": {
|
||||
"**/.git": true,
|
||||
"**/.DS_Store": true,
|
||||
"**/*.js.map": true,
|
||||
"**/*.js": {"when": "$(basename).ts"}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"version": "0.1.0",
|
||||
"command": "gulp",
|
||||
"isShellCommand": true,
|
||||
"args": [
|
||||
"--no-color"
|
||||
],
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "build",
|
||||
"isBuildCommand": true,
|
||||
"problemMatcher": "$tsc"
|
||||
},
|
||||
{
|
||||
"taskName": "less",
|
||||
"problemMatcher": "$lessCompile"
|
||||
},
|
||||
{
|
||||
"taskName": "test",
|
||||
"args": [],
|
||||
"isTestCommand": true
|
||||
},
|
||||
{
|
||||
"taskName": "buildTests",
|
||||
"problemMatcher": "$tsc"
|
||||
},
|
||||
{
|
||||
"taskName": "buildAll",
|
||||
"problemMatcher": ["$tsc", "$lessCompile"]
|
||||
},
|
||||
{
|
||||
"taskName": "watch",
|
||||
"problemMatcher": ["$tsc", "$lessCompile"]
|
||||
}
|
||||
|
||||
]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
# README
|
||||
## This the readme for your application "node-express-typescript"
|
||||
-------------------
|
||||
### Visual Studio Code has *awesome* Markdown support!
|
||||
|
||||
* Split the editor (`Cmd+\` on OSX or `Ctrl+\` on Windows and Linux)
|
||||
* Toggle preview (`Shift+CMD+V` on OSX or `Shift+Ctrl+V` on Windows and Linux)
|
||||
* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (OSX) to see a list of Markdown snippets
|
||||
|
||||
### For more information
|
||||
* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
|
||||
* [Markdown Syntax Reference](http://daringfireball.net)
|
||||
|
||||
** Enjoy!**
|
|
@ -0,0 +1,88 @@
|
|||
var gulp = require('gulp');
|
||||
var less = require('gulp-less');
|
||||
var path = require('path');
|
||||
var mocha = require('gulp-mocha');
|
||||
var browserSync = require('browser-sync');
|
||||
var nodemon = require('gulp-nodemon');
|
||||
var cp = require('child_process');
|
||||
var tsb = require('gulp-tsb');
|
||||
|
||||
|
||||
// compile less files from the ./styles folder
|
||||
// into css files to the ./public/stylesheets folder
|
||||
gulp.task('less', function () {
|
||||
return gulp.src('./src/styles/**/*.less')
|
||||
.pipe(less({
|
||||
paths: [path.join(__dirname, 'less', 'includes')]
|
||||
}))
|
||||
.pipe(gulp.dest('./src/public/stylesheets'));
|
||||
});
|
||||
|
||||
|
||||
// run mocha tests in the ./tests folder
|
||||
gulp.task('test', function () {
|
||||
|
||||
return gulp.src('./tests/test*.js', { read: false })
|
||||
// gulp-mocha needs filepaths so you can't have any plugins before it
|
||||
.pipe(mocha());
|
||||
});
|
||||
|
||||
// run browser-sync on for client changes
|
||||
gulp.task('browser-sync', ['nodemon', 'watch'], function () {
|
||||
browserSync.init(null, {
|
||||
proxy: "http://localhost:3000",
|
||||
files: ["src/public/**/*.*", "src/views/**/*.*"],
|
||||
browser: "google chrome",
|
||||
port: 7000,
|
||||
});
|
||||
});
|
||||
|
||||
// run nodemon on server file changes
|
||||
gulp.task('nodemon', function (cb) {
|
||||
var started = false;
|
||||
|
||||
return nodemon({
|
||||
script: 'src/www.js',
|
||||
watch: ['src/*.js']
|
||||
}).on('start', function () {
|
||||
if (!started) {
|
||||
cb();
|
||||
started = true;
|
||||
}
|
||||
}).on('restart', function onRestart() {
|
||||
setTimeout(function reload() {
|
||||
browserSync.reload({
|
||||
stream: false
|
||||
});
|
||||
}, 500); // browserSync reload delay
|
||||
});
|
||||
});
|
||||
|
||||
// TypeScript build for /src folder, pipes in .d.ts files from typings folder
|
||||
var tsConfigSrc = tsb.create('src/tsconfig.json');
|
||||
gulp.task('build', function () {
|
||||
return gulp.src(['typings/**/*.ts', 'src/**/*.ts'])
|
||||
.pipe(tsConfigSrc())
|
||||
.pipe(gulp.dest('src'));
|
||||
});
|
||||
|
||||
// TypeScript build for /tests folder, pipes in .d.ts files from typings folder
|
||||
// as well as the src/tsd.d.ts which is referenced by tests/tsd.d.ts
|
||||
var tsConfigTests = tsb.create('tests/tsconfig.json');
|
||||
gulp.task('buildTests', function () {
|
||||
// pipe in all necessary files
|
||||
return gulp.src(['typings/**/*.ts', 'tests/**/*.ts', 'src/tsd.d.ts'])
|
||||
.pipe(tsConfigTests())
|
||||
.pipe(gulp.dest('tests'));
|
||||
});
|
||||
|
||||
// watch for any TypeScript or LESS file changes
|
||||
// if a file change is detected, run the TypeScript or LESS compile gulp tasks
|
||||
gulp.task('watch', function () {
|
||||
gulp.watch('src/**/*.ts', ['build']);
|
||||
gulp.watch('tests/**/*.ts', ['buildTests']);
|
||||
gulp.watch('src/styles/**/*.less', ['less']);
|
||||
});
|
||||
|
||||
gulp.task('buildAll', ['build', 'buildTests', 'less']);
|
||||
gulp.task('default', ['browser-sync']);
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "node-express-typescript",
|
||||
"description": "node-express-typescript Sample Application (TypeScript)",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node ./src/www.js",
|
||||
"test": "mocha ./tests/test.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"body-parser": "~1.12.0",
|
||||
"cookie-parser": "~1.3.4",
|
||||
"debug": "~2.1.1",
|
||||
"express": "~4.12.2",
|
||||
"jade": "~1.9.2",
|
||||
"less-middleware": "1.0.x",
|
||||
"morgan": "~1.5.1",
|
||||
"serve-favicon": "~2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browser-sync": "^2.8.2",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-less": "^3.0.3",
|
||||
"gulp-mocha": "^2.1.2",
|
||||
"gulp-nodemon": "^2.0.3",
|
||||
"gulp-tsb": "^1.4.4",
|
||||
"marked": "^0.3.5",
|
||||
"mocha": "^2.2.5",
|
||||
"nodemon": "^1.4.0"
|
||||
}
|
||||
}
|
Двоичный файл не отображается.
|
@ -0,0 +1,51 @@
|
|||
var express = require('express');
|
||||
var logger = require('morgan');
|
||||
var bodyParser = require('body-parser');
|
||||
var path_1 = require('path');
|
||||
var index_1 = require('./routes/index');
|
||||
var users_1 = require('./routes/users');
|
||||
var cookieParser = require('cookie-parser'); // this module doesn't use the ES6 default export yet
|
||||
var app = express();
|
||||
// view engine setup
|
||||
app.set('views', path_1.join(__dirname, 'views'));
|
||||
app.set('view engine', 'jade');
|
||||
// uncomment after placing your favicon in /public
|
||||
//app.use(favicon(__dirname + '/public/favicon.ico'));
|
||||
app.use(logger('dev'));
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({ extended: false }));
|
||||
app.use(cookieParser());
|
||||
app.use(express.static(path_1.join(__dirname, 'public')));
|
||||
app.use('/', index_1.default);
|
||||
app.use('/users', users_1.default);
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function (req, res, next) {
|
||||
var err = new Error('Not Found');
|
||||
err['status'] = 404;
|
||||
next(err);
|
||||
});
|
||||
// error handlers
|
||||
// development error handler
|
||||
// will print stacktrace
|
||||
if (app.get('env') === 'development') {
|
||||
app.use(function (error, req, res, next) {
|
||||
res.status(error['status'] || 500);
|
||||
res.render('error', {
|
||||
message: error.message,
|
||||
error: error
|
||||
});
|
||||
});
|
||||
}
|
||||
// production error handler
|
||||
// no stacktraces leaked to user
|
||||
app.use(function (error, req, res, next) {
|
||||
res.status(error['status'] || 500);
|
||||
res.render('error', {
|
||||
message: error.message,
|
||||
error: {}
|
||||
});
|
||||
return null;
|
||||
});
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = app;
|
||||
//# sourceMappingURL=app.js.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"app.js","sourceRoot":"","sources":["app.ts"],"names":[],"mappings":"AAAA,IAAY,OAAO,WAAM,SAAS,CAAC,CAAA;AACnC,IAAY,MAAM,WAAM,QAAQ,CAAC,CAAA;AACjC,IAAY,UAAU,WAAM,aAAa,CAAC,CAAA;AAC1C,qBAAmB,MAAM,CAAC,CAAA;AAC1B,sBAAkB,gBAAgB,CAAC,CAAA;AACnC,sBAAkB,gBAAgB,CAAC,CAAA;AACnC,IAAO,YAAY,WAAW,eAAe,CAAC,CAAC,CAAC,qDAAqD;AAErG,IAAM,GAAG,GAAoB,OAAO,EAAE,CAAC;AAEvC,oBAAoB;AACpB,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,WAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAC3C,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAE/B,kDAAkD;AAClD,sDAAsD;AACtD,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACvB,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;AAC3B,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AACpD,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC;AACxB,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,WAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;AAEnD,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,eAAK,CAAC,CAAC;AACpB,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,eAAK,CAAC,CAAC;AAEzB,yCAAyC;AACzC,GAAG,CAAC,GAAG,CAAC,UAAC,GAAG,EAAE,GAAG,EAAE,IAAI;IACrB,IAAI,GAAG,GAAG,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;IACjC,GAAG,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC;IACpB,IAAI,CAAC,GAAG,CAAC,CAAC;AACZ,CAAC,CAAC,CAAC;AAEH,iBAAiB;AAEjB,4BAA4B;AAC5B,wBAAwB;AACxB,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,aAAa,CAAC,CAAC,CAAC;IAErC,GAAG,CAAC,GAAG,CAAC,UAAC,KAAU,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI;QACjC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;QACnC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE;YAClB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,OAAA,KAAK;SACN,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,2BAA2B;AAC3B,gCAAgC;AAChC,GAAG,CAAC,GAAG,CAAC,UAAC,KAAU,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI;IACjC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;IACnC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE;QAClB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,KAAK,EAAE,EAAE;KACV,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC;AACd,CAAC,CAAC,CAAC;AAGH;kBAAe,GAAG,CAAC"}
|
|
@ -0,0 +1,60 @@
|
|||
import * as express from 'express';
|
||||
import * as logger from 'morgan';
|
||||
import * as bodyParser from 'body-parser';
|
||||
import {join} from 'path';
|
||||
import index from './routes/index';
|
||||
import users from './routes/users';
|
||||
import cookieParser = require('cookie-parser'); // this module doesn't use the ES6 default export yet
|
||||
|
||||
const app: express.Express = express();
|
||||
|
||||
// view engine setup
|
||||
app.set('views', join(__dirname, 'views'));
|
||||
app.set('view engine', 'jade');
|
||||
|
||||
// uncomment after placing your favicon in /public
|
||||
//app.use(favicon(__dirname + '/public/favicon.ico'));
|
||||
app.use(logger('dev'));
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({ extended: false }));
|
||||
app.use(cookieParser());
|
||||
app.use(express.static(join(__dirname, 'public')));
|
||||
|
||||
app.use('/', index);
|
||||
app.use('/users', users);
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use((req, res, next) => {
|
||||
var err = new Error('Not Found');
|
||||
err['status'] = 404;
|
||||
next(err);
|
||||
});
|
||||
|
||||
// error handlers
|
||||
|
||||
// development error handler
|
||||
// will print stacktrace
|
||||
if (app.get('env') === 'development') {
|
||||
|
||||
app.use((error: any, req, res, next) => {
|
||||
res.status(error['status'] || 500);
|
||||
res.render('error', {
|
||||
message: error.message,
|
||||
error
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// production error handler
|
||||
// no stacktraces leaked to user
|
||||
app.use((error: any, req, res, next) => {
|
||||
res.status(error['status'] || 500);
|
||||
res.render('error', {
|
||||
message: error.message,
|
||||
error: {}
|
||||
});
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
export default app;
|
|
@ -0,0 +1,10 @@
|
|||
body {
|
||||
padding: 50px;
|
||||
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
a {
|
||||
color: blue;
|
||||
}
|
||||
.blocktext {
|
||||
font-family: Courier New, Courier, monospace;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
var express_1 = require('express');
|
||||
var index = express_1.Router();
|
||||
/* GET home page. */
|
||||
index.get('/', function (req, res, next) {
|
||||
res.render('index', { title: 'Visual Studio Code!' });
|
||||
});
|
||||
/* GET Quick Start. */
|
||||
index.get('/quickstart', function (req, res, next) {
|
||||
res.render('quickstart');
|
||||
});
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = index;
|
||||
//# sourceMappingURL=index.js.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,wBAAqB,SAAS,CAAC,CAAA;AAE/B,IAAM,KAAK,GAAG,gBAAM,EAAE,CAAC;AAEvB,oBAAoB;AACpB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,UAAS,GAAG,EAAE,GAAG,EAAE,IAAI;IACpC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC,CAAC;AACxD,CAAC,CAAC,CAAC;AAEH,sBAAsB;AACtB,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE,UAAS,GAAG,EAAE,GAAG,EAAE,IAAI;IAC9C,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEH;kBAAe,KAAK,CAAC"}
|
|
@ -0,0 +1,15 @@
|
|||
import {Router} from 'express';
|
||||
|
||||
const index = Router();
|
||||
|
||||
/* GET home page. */
|
||||
index.get('/', function(req, res, next) {
|
||||
res.render('index', { title: 'Visual Studio Code!' });
|
||||
});
|
||||
|
||||
/* GET Quick Start. */
|
||||
index.get('/quickstart', function(req, res, next) {
|
||||
res.render('quickstart');
|
||||
});
|
||||
|
||||
export default index;
|
|
@ -0,0 +1,9 @@
|
|||
var express_1 = require('express');
|
||||
var users = express_1.Router();
|
||||
/* GET users listing. */
|
||||
users.get('/', function (req, res, next) {
|
||||
res.send('respond with a resource');
|
||||
});
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = users;
|
||||
//# sourceMappingURL=users.js.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"users.js","sourceRoot":"","sources":["users.ts"],"names":[],"mappings":"AAAA,wBAAqB,SAAS,CAAC,CAAA;AAE/B,IAAM,KAAK,GAAG,gBAAM,EAAE,CAAC;AAEvB,wBAAwB;AACxB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,UAAS,GAAG,EAAE,GAAG,EAAE,IAAI;IACpC,GAAG,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AACtC,CAAC,CAAC,CAAC;AAEH;kBAAe,KAAK,CAAC"}
|
|
@ -0,0 +1,10 @@
|
|||
import {Router} from 'express';
|
||||
|
||||
const users = Router();
|
||||
|
||||
/* GET users listing. */
|
||||
users.get('/', function(req, res, next) {
|
||||
res.send('respond with a resource');
|
||||
});
|
||||
|
||||
export default users;
|
|
@ -0,0 +1,14 @@
|
|||
@linkcolor: blue;
|
||||
|
||||
body {
|
||||
padding: 50px;
|
||||
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: @linkcolor
|
||||
}
|
||||
|
||||
.blocktext {
|
||||
font-family: Courier New, Courier, monospace;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES5",
|
||||
"module": "commonjs",
|
||||
"sourceMap": true,
|
||||
"noImplicitAny": false,
|
||||
"removeComments": false,
|
||||
"preserveConstEnums": true
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
/// <reference path="../typings/body-parser/body-parser.d.ts" />
|
||||
/// <reference path="../typings/cookie-parser/cookie-parser.d.ts" />
|
||||
/// <reference path="../typings/debug/debug.d.ts" />
|
||||
/// <reference path="../typings/express/express.d.ts" />
|
||||
/// <reference path="../typings/morgan/morgan.d.ts" />
|
||||
/// <reference path="../typings/node/node.d.ts" />
|
||||
/// <reference path="../typings/serve-favicon/serve-favicon.d.ts" />
|
||||
/// <reference path="../typings/mocha/mocha.d.ts" />
|
||||
/// <reference path="../typings/gulp/gulp.d.ts" />
|
|
@ -0,0 +1,6 @@
|
|||
extends layout
|
||||
|
||||
block content
|
||||
h1= message
|
||||
h2= error.status
|
||||
pre #{error.stack}
|
|
@ -0,0 +1,9 @@
|
|||
extends layout
|
||||
|
||||
block content
|
||||
h1 Visual Studio Code - Starter Express Application (TypeScript)
|
||||
p Welcome to #{title}
|
||||
|
||||
| For more information, please see the
|
||||
a(href='/quickstart') Quick Start
|
||||
|.
|
|
@ -0,0 +1,7 @@
|
|||
doctype html
|
||||
html
|
||||
head
|
||||
title= title
|
||||
link(rel='stylesheet', href='/stylesheets/style.css')
|
||||
body
|
||||
block content
|
|
@ -0,0 +1,4 @@
|
|||
extends layout
|
||||
|
||||
block content
|
||||
include:md ../../vscodequickstart.md
|
|
@ -0,0 +1,62 @@
|
|||
var app_1 = require('./app');
|
||||
var debugModule = require('debug');
|
||||
var http = require('http');
|
||||
var debug = debugModule('node-express-typescript:server');
|
||||
// Get port from environment and store in Express.
|
||||
var port = normalizePort(process.env.PORT || '3000');
|
||||
app_1.default.set('port', port);
|
||||
// create server and listen on provided port (on all network interfaces).
|
||||
var server = http.createServer(app_1.default);
|
||||
server.listen(port);
|
||||
server.on('error', onError);
|
||||
server.on('listening', onListening);
|
||||
/**
|
||||
* Normalize a port into a number, string, or false.
|
||||
*/
|
||||
function normalizePort(val) {
|
||||
var port = parseInt(val, 10);
|
||||
if (isNaN(port)) {
|
||||
// named pipe
|
||||
return val;
|
||||
}
|
||||
if (port >= 0) {
|
||||
// port number
|
||||
return port;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Event listener for HTTP server "error" event.
|
||||
*/
|
||||
function onError(error) {
|
||||
if (error.syscall !== 'listen') {
|
||||
throw error;
|
||||
}
|
||||
var bind = typeof port === 'string'
|
||||
? 'Pipe ' + port
|
||||
: 'Port ' + port;
|
||||
// handle specific listen errors with friendly messages
|
||||
switch (error.code) {
|
||||
case 'EACCES':
|
||||
console.error(bind + ' requires elevated privileges');
|
||||
process.exit(1);
|
||||
break;
|
||||
case 'EADDRINUSE':
|
||||
console.error(bind + ' is already in use');
|
||||
process.exit(1);
|
||||
break;
|
||||
default:
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Event listener for HTTP server "listening" event.
|
||||
*/
|
||||
function onListening() {
|
||||
var addr = server.address();
|
||||
var bind = typeof addr === 'string'
|
||||
? 'pipe ' + addr
|
||||
: 'port ' + addr.port;
|
||||
debug('Listening on ' + bind);
|
||||
}
|
||||
//# sourceMappingURL=www.js.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"www.js","sourceRoot":"","sources":["www.ts"],"names":["normalizePort","onError","onListening"],"mappings":"AAAA,oBAAgB,OAAO,CAAC,CAAA;AACxB,IAAO,WAAW,WAAW,OAAO,CAAC,CAAC;AACtC,IAAO,IAAI,WAAW,MAAM,CAAC,CAAC;AAE9B,IAAM,KAAK,GAAG,WAAW,CAAC,gCAAgC,CAAC,CAAC;AAE5D,kDAAkD;AAClD,IAAM,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC;AACvD,aAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAEtB,yEAAyE;AACzE,IAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,aAAG,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5B,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAEpC;;GAEG;AACH,uBAAuB,GAAQ;IAC7BA,IAAIA,IAAIA,GAAGA,QAAQA,CAACA,GAAGA,EAAEA,EAAEA,CAACA,CAACA;IAE7BA,EAAEA,CAACA,CAACA,KAAKA,CAACA,IAAIA,CAACA,CAACA,CAACA,CAACA;QAChBA,aAAaA;QACbA,MAAMA,CAACA,GAAGA,CAACA;IACbA,CAACA;IAEDA,EAAEA,CAACA,CAACA,IAAIA,IAAIA,CAACA,CAACA,CAACA,CAACA;QACdA,cAAcA;QACdA,MAAMA,CAACA,IAAIA,CAACA;IACdA,CAACA;IAEDA,MAAMA,CAACA,KAAKA,CAACA;AACfA,CAACA;AAED;;GAEG;AACH,iBAAiB,KAAK;IACpBC,EAAEA,CAACA,CAACA,KAAKA,CAACA,OAAOA,KAAKA,QAAQA,CAACA,CAACA,CAACA;QAC/BA,MAAMA,KAAKA,CAACA;IACdA,CAACA;IAEDA,IAAIA,IAAIA,GAAGA,OAAOA,IAAIA,KAAKA,QAAQA;UAC/BA,OAAOA,GAAGA,IAAIA;UACdA,OAAOA,GAAGA,IAAIA,CAAAA;IAElBA,uDAAuDA;IACvDA,MAAMA,CAACA,CAACA,KAAKA,CAACA,IAAIA,CAACA,CAACA,CAACA;QACnBA,KAAKA,QAAQA;YACXA,OAAOA,CAACA,KAAKA,CAACA,IAAIA,GAAGA,+BAA+BA,CAACA,CAACA;YACtDA,OAAOA,CAACA,IAAIA,CAACA,CAACA,CAACA,CAACA;YAChBA,KAAKA,CAACA;QACRA,KAAKA,YAAYA;YACfA,OAAOA,CAACA,KAAKA,CAACA,IAAIA,GAAGA,oBAAoBA,CAACA,CAACA;YAC3CA,OAAOA,CAACA,IAAIA,CAACA,CAACA,CAACA,CAACA;YAChBA,KAAKA,CAACA;QACRA;YACEA,MAAMA,KAAKA,CAACA;IAChBA,CAACA;AACHA,CAACA;AAED;;GAEG;AACH;IACEC,IAAIA,IAAIA,GAAGA,MAAMA,CAACA,OAAOA,EAAEA,CAACA;IAC5BA,IAAIA,IAAIA,GAAGA,OAAOA,IAAIA,KAAKA,QAAQA;UAC/BA,OAAOA,GAAGA,IAAIA;UACdA,OAAOA,GAAGA,IAAIA,CAACA,IAAIA,CAACA;IAExBA,KAAKA,CAACA,eAAeA,GAAGA,IAAIA,CAACA,CAACA;AAChCA,CAACA"}
|
|
@ -0,0 +1,73 @@
|
|||
import app from './app';
|
||||
import debugModule = require('debug');
|
||||
import http = require('http');
|
||||
|
||||
const debug = debugModule('node-express-typescript:server');
|
||||
|
||||
// Get port from environment and store in Express.
|
||||
const port = normalizePort(process.env.PORT || '3000');
|
||||
app.set('port', port);
|
||||
|
||||
// create server and listen on provided port (on all network interfaces).
|
||||
const server = http.createServer(app);
|
||||
server.listen(port);
|
||||
server.on('error', onError);
|
||||
server.on('listening', onListening);
|
||||
|
||||
/**
|
||||
* Normalize a port into a number, string, or false.
|
||||
*/
|
||||
function normalizePort(val: any): number|string|boolean {
|
||||
let port = parseInt(val, 10);
|
||||
|
||||
if (isNaN(port)) {
|
||||
// named pipe
|
||||
return val;
|
||||
}
|
||||
|
||||
if (port >= 0) {
|
||||
// port number
|
||||
return port;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "error" event.
|
||||
*/
|
||||
function onError(error) {
|
||||
if (error.syscall !== 'listen') {
|
||||
throw error;
|
||||
}
|
||||
|
||||
let bind = typeof port === 'string'
|
||||
? 'Pipe ' + port
|
||||
: 'Port ' + port
|
||||
|
||||
// handle specific listen errors with friendly messages
|
||||
switch (error.code) {
|
||||
case 'EACCES':
|
||||
console.error(bind + ' requires elevated privileges');
|
||||
process.exit(1);
|
||||
break;
|
||||
case 'EADDRINUSE':
|
||||
console.error(bind + ' is already in use');
|
||||
process.exit(1);
|
||||
break;
|
||||
default:
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "listening" event.
|
||||
*/
|
||||
function onListening() {
|
||||
let addr = server.address();
|
||||
let bind = typeof addr === 'string'
|
||||
? 'pipe ' + addr
|
||||
: 'port ' + addr.port;
|
||||
|
||||
debug('Listening on ' + bind);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
var assert = require('assert');
|
||||
describe('Array', function () {
|
||||
describe('#indexOf()', function () {
|
||||
it('should return -1 when the value is not present', function () {
|
||||
assert.equal(-1, [1, 2, 3].indexOf(5));
|
||||
assert.equal(-1, [1, 2, 3].indexOf(0));
|
||||
});
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=test.js.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AACA,IAAO,MAAM,WAAW,QAAQ,CAAC,CAAC;AAElC,QAAQ,CAAC,OAAO,EAAE;IAChB,QAAQ,CAAC,YAAY,EAAE;QACrB,EAAE,CAAC,gDAAgD,EAAE;YACnD,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YACrC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
import assert = require('assert');
|
||||
|
||||
describe('Array', function(){
|
||||
describe('#indexOf()', function(){
|
||||
it('should return -1 when the value is not present', function(){
|
||||
assert.equal(-1, [1,2,3].indexOf(5));
|
||||
assert.equal(-1, [1,2,3].indexOf(0));
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES5",
|
||||
"module": "commonjs",
|
||||
"sourceMap": true,
|
||||
"noImplicitAny": false,
|
||||
"removeComments": false,
|
||||
"preserveConstEnums": true
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
/// <reference path="../src/tsd.d.ts" />
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"version": "v4",
|
||||
"repo": "borisyankov/DefinitelyTyped",
|
||||
"ref": "master",
|
||||
"path": "typings",
|
||||
"bundle": "src/tsd.d.ts",
|
||||
"installed": {
|
||||
"express/express.d.ts": {
|
||||
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
|
||||
},
|
||||
"node/node.d.ts": {
|
||||
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
|
||||
},
|
||||
"serve-favicon/serve-favicon.d.ts": {
|
||||
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
|
||||
},
|
||||
"morgan/morgan.d.ts": {
|
||||
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
|
||||
},
|
||||
"cookie-parser/cookie-parser.d.ts": {
|
||||
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
|
||||
},
|
||||
"body-parser/body-parser.d.ts": {
|
||||
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
|
||||
},
|
||||
"debug/debug.d.ts": {
|
||||
"commit": "32f0a90dab26f70b206407ac24d4d622d0f0f408"
|
||||
},
|
||||
"mocha/mocha.d.ts": {
|
||||
"commit": "983126e131a2b81739053d60e4bbdbb46d6577b7"
|
||||
},
|
||||
"gulp/gulp.d.ts": {
|
||||
"commit": "3d2916191781fe400176a030c03722ac4b87f1c1"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
// Type definitions for body-parser
|
||||
// Project: http://expressjs.com
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo/>, VILIC VANE <https://vilic.info>, Jonathan Häberle <https://github.com/dreampulse/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module "body-parser" {
|
||||
import express = require('express');
|
||||
|
||||
/**
|
||||
* bodyParser: use individual json/urlencoded middlewares
|
||||
* @deprecated
|
||||
*/
|
||||
|
||||
function bodyParser(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* only parse objects and arrays. (default: true)
|
||||
*/
|
||||
strict?: boolean;
|
||||
/**
|
||||
* passed to JSON.parse().
|
||||
*/
|
||||
receiver?: (key: string, value: any) => any;
|
||||
/**
|
||||
* parse extended syntax with the qs module. (default: true)
|
||||
*/
|
||||
extended?: boolean;
|
||||
}): express.RequestHandler;
|
||||
|
||||
module bodyParser {
|
||||
export function json(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'json')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* only parse objects and arrays. (default: true)
|
||||
*/
|
||||
strict?: boolean;
|
||||
/**
|
||||
* passed to JSON.parse().
|
||||
*/
|
||||
receiver?: (key: string, value: any) => any;
|
||||
}): express.RequestHandler;
|
||||
|
||||
export function raw(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'application/octet-stream')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
}): express.RequestHandler;
|
||||
|
||||
export function text(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'text/plain')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* the default charset to parse as, if not specified in content-type. (default: 'utf-8')
|
||||
*/
|
||||
defaultCharset?: string;
|
||||
}): express.RequestHandler;
|
||||
|
||||
export function urlencoded(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'urlencoded')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* parse extended syntax with the qs module. (default: true)
|
||||
*/
|
||||
extended?: boolean;
|
||||
}): express.RequestHandler;
|
||||
}
|
||||
|
||||
export = bodyParser;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
// Type definitions for cookie-parser
|
||||
// Project: https://github.com/expressjs/cookie-parser
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module "cookie-parser" {
|
||||
import express = require('express');
|
||||
function e(secret?: string, options?: any): express.RequestHandler;
|
||||
export = e;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
// Type definitions for debug
|
||||
// Project: https://github.com/visionmedia/debug
|
||||
// Definitions by: Seon-Wook Park <https://github.com/swook>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "debug" {
|
||||
|
||||
function d(namespace: string): d.Debugger;
|
||||
|
||||
module d {
|
||||
export var log: Function;
|
||||
|
||||
function enable(namespaces: string): void;
|
||||
function disable(): void;
|
||||
|
||||
function enabled(namespace: string): boolean;
|
||||
|
||||
export interface Debugger {
|
||||
(formatter: any, ...args: any[]): void;
|
||||
|
||||
enabled: boolean;
|
||||
log: Function;
|
||||
namespace: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = d;
|
||||
|
||||
}
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,264 @@
|
|||
// Type definitions for Gulp v3.8.x
|
||||
// Project: http://gulpjs.com
|
||||
// Definitions by: Drew Noakes <https://drewnoakes.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module gulp {
|
||||
|
||||
/**
|
||||
* Options to pass to node-glob through glob-stream.
|
||||
* Specifies two options in addition to those used by node-glob:
|
||||
* https://github.com/isaacs/node-glob#options
|
||||
*/
|
||||
interface ISrcOptions {
|
||||
/**
|
||||
* Setting this to <code>false</code> will return <code>file.contents</code> as <code>null</code>
|
||||
* and not read the file at all.
|
||||
* Default: <code>true</code>.
|
||||
*/
|
||||
read?: boolean;
|
||||
|
||||
/**
|
||||
* Setting this to false will return <code>file.contents</code> as a stream and not buffer files.
|
||||
* This is useful when working with large files.
|
||||
* Note: Plugins might not implement support for streams.
|
||||
* Default: <code>true</code>.
|
||||
*/
|
||||
buffer?: boolean;
|
||||
|
||||
/**
|
||||
* The current working directory in which to search.
|
||||
* Defaults to process.cwd().
|
||||
*/
|
||||
cwd?: string;
|
||||
|
||||
/**
|
||||
* The place where patterns starting with / will be mounted onto.
|
||||
* Defaults to path.resolve(options.cwd, "/") (/ on Unix systems, and C:\ or some such on Windows.)
|
||||
*/
|
||||
root?: string;
|
||||
|
||||
/**
|
||||
* Include .dot files in normal matches and globstar matches.
|
||||
* Note that an explicit dot in a portion of the pattern will always match dot files.
|
||||
*/
|
||||
dot?: boolean;
|
||||
|
||||
/**
|
||||
* By default, a pattern starting with a forward-slash will be "mounted" onto the root setting, so that a valid
|
||||
* filesystem path is returned. Set this flag to disable that behavior.
|
||||
*/
|
||||
nomount?: boolean;
|
||||
|
||||
/**
|
||||
* Add a / character to directory matches. Note that this requires additional stat calls.
|
||||
*/
|
||||
mark?: boolean;
|
||||
|
||||
/**
|
||||
* Don't sort the results.
|
||||
*/
|
||||
nosort?: boolean;
|
||||
|
||||
/**
|
||||
* Set to true to stat all results. This reduces performance somewhat, and is completely unnecessary, unless
|
||||
* readdir is presumed to be an untrustworthy indicator of file existence. It will cause ELOOP to be triggered one
|
||||
* level sooner in the case of cyclical symbolic links.
|
||||
*/
|
||||
stat?: boolean;
|
||||
|
||||
/**
|
||||
* When an unusual error is encountered when attempting to read a directory, a warning will be printed to stderr.
|
||||
* Set the silent option to true to suppress these warnings.
|
||||
*/
|
||||
silent?: boolean;
|
||||
|
||||
/**
|
||||
* When an unusual error is encountered when attempting to read a directory, the process will just continue on in
|
||||
* search of other matches. Set the strict option to raise an error in these cases.
|
||||
*/
|
||||
strict?: boolean;
|
||||
|
||||
/**
|
||||
* See cache property above. Pass in a previously generated cache object to save some fs calls.
|
||||
*/
|
||||
cache?: boolean;
|
||||
|
||||
/**
|
||||
* A cache of results of filesystem information, to prevent unnecessary stat calls.
|
||||
* While it should not normally be necessary to set this, you may pass the statCache from one glob() call to the
|
||||
* options object of another, if you know that the filesystem will not change between calls.
|
||||
*/
|
||||
statCache?: boolean;
|
||||
|
||||
/**
|
||||
* Perform a synchronous glob search.
|
||||
*/
|
||||
sync?: boolean;
|
||||
|
||||
/**
|
||||
* In some cases, brace-expanded patterns can result in the same file showing up multiple times in the result set.
|
||||
* By default, this implementation prevents duplicates in the result set. Set this flag to disable that behavior.
|
||||
*/
|
||||
nounique?: boolean;
|
||||
|
||||
/**
|
||||
* Set to never return an empty set, instead returning a set containing the pattern itself.
|
||||
* This is the default in glob(3).
|
||||
*/
|
||||
nonull?: boolean;
|
||||
|
||||
/**
|
||||
* Perform a case-insensitive match. Note that case-insensitive filesystems will sometimes result in glob returning
|
||||
* results that are case-insensitively matched anyway, since readdir and stat will not raise an error.
|
||||
*/
|
||||
nocase?: boolean;
|
||||
|
||||
/**
|
||||
* Set to enable debug logging in minimatch and glob.
|
||||
*/
|
||||
debug?: boolean;
|
||||
|
||||
/**
|
||||
* Set to enable debug logging in glob, but not minimatch.
|
||||
*/
|
||||
globDebug?: boolean;
|
||||
}
|
||||
|
||||
interface IDestOptions {
|
||||
/**
|
||||
* The output folder. Only has an effect if provided output folder is relative.
|
||||
* Default: process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
|
||||
/**
|
||||
* Octal permission string specifying mode for any folders that need to be created for output folder.
|
||||
* Default: 0777.
|
||||
*/
|
||||
mode?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options that are passed to <code>gaze</code>.
|
||||
* https://github.com/shama/gaze
|
||||
*/
|
||||
interface IWatchOptions {
|
||||
/** Interval to pass to fs.watchFile. */
|
||||
interval?: number;
|
||||
/** Delay for events called in succession for the same file/event. */
|
||||
debounceDelay?: number;
|
||||
/** Force the watch mode. Either 'auto' (default), 'watch' (force native events), or 'poll' (force stat polling). */
|
||||
mode?: string;
|
||||
/** The current working directory to base file patterns from. Default is process.cwd().. */
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
interface IWatchEvent {
|
||||
/** The type of change that occurred, either added, changed or deleted. */
|
||||
type: string;
|
||||
/** The path to the file that triggered the event. */
|
||||
path: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to be called on each watched file change.
|
||||
*/
|
||||
interface IWatchCallback {
|
||||
(event:IWatchEvent): void;
|
||||
}
|
||||
|
||||
interface ITaskCallback {
|
||||
/**
|
||||
* Defines a task.
|
||||
* Tasks may be made asynchronous if they are passing a callback or return a promise or a stream.
|
||||
* @param cb callback used to signal asynchronous completion. Caller includes <code>err</code> in case of error.
|
||||
*/
|
||||
(cb?:(err?:any)=>void): any;
|
||||
}
|
||||
|
||||
interface EventEmitter {
|
||||
any: any;
|
||||
}
|
||||
|
||||
interface Gulp {
|
||||
/**
|
||||
* Define a task.
|
||||
*
|
||||
* @param name the name of the task. Tasks that you want to run from the command line should not have spaces in them.
|
||||
* @param fn the function that performs the task's operations. Generally this takes the form of gulp.src().pipe(someplugin()).
|
||||
*/
|
||||
task(name:string, fn:ITaskCallback): any;
|
||||
|
||||
/**
|
||||
* Define a task.
|
||||
*
|
||||
* @param name the name of the task. Tasks that you want to run from the command line should not have spaces in them.
|
||||
* @param dep an array of tasks to be executed and completed before your task will run.
|
||||
* @param fn the function that performs the task's operations. Generally this takes the form of gulp.src().pipe(someplugin()).
|
||||
*/
|
||||
task(name:string, dep:string[], fn?:ITaskCallback): any;
|
||||
|
||||
|
||||
/**
|
||||
* Takes a glob and represents a file structure. Can be piped to plugins.
|
||||
* @param glob a glob string, using node-glob syntax
|
||||
* @param opt an optional option object
|
||||
*/
|
||||
src(glob:string, opt?:ISrcOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
/**
|
||||
* Takes a glob and represents a file structure. Can be piped to plugins.
|
||||
* @param glob an array of glob strings, using node-glob syntax
|
||||
* @param opt an optional option object
|
||||
*/
|
||||
src(glob:string[], opt?:ISrcOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
|
||||
/**
|
||||
* Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders.
|
||||
* Folders that don't exist will be created.
|
||||
*
|
||||
* @param outFolder the path (output folder) to write files to.
|
||||
* @param opt
|
||||
*/
|
||||
dest(outFolder:string, opt?:IDestOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
/**
|
||||
* Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders.
|
||||
* Folders that don't exist will be created.
|
||||
*
|
||||
* @param outFolder a function that converts a vinyl File instance into an output path
|
||||
* @param opt
|
||||
*/
|
||||
dest(outFolder:(file:string)=>string, opt?:IDestOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
|
||||
/**
|
||||
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
|
||||
*
|
||||
* @param glob a single glob or array of globs that indicate which files to watch for changes.
|
||||
* @param opt options, that are passed to the gaze library.
|
||||
* @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with gulp.task().
|
||||
*/
|
||||
watch(glob:string, fn:(IWatchCallback|string)): EventEmitter;
|
||||
watch(glob:string, fn:(IWatchCallback|string)[]): EventEmitter;
|
||||
watch(glob:string, opt:IWatchOptions, fn:(IWatchCallback|string)): EventEmitter;
|
||||
watch(glob:string, opt:IWatchOptions, fn:(IWatchCallback|string)[]): EventEmitter;
|
||||
watch(glob:string[], fn:(IWatchCallback|string)): EventEmitter;
|
||||
watch(glob:string[], fn:(IWatchCallback|string)[]): EventEmitter;
|
||||
watch(glob:string[], opt:IWatchOptions, fn:(IWatchCallback|string)): EventEmitter;
|
||||
watch(glob:string[], opt:IWatchOptions, fn:(IWatchCallback|string)[]): EventEmitter;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "gulp" {
|
||||
var _tmp:gulp.Gulp;
|
||||
export = _tmp;
|
||||
}
|
||||
|
||||
interface IGulpPlugin {
|
||||
(...args: any[]): NodeJS.ReadWriteStream;
|
||||
}
|
|
@ -0,0 +1,214 @@
|
|||
// Type definitions for mocha 2.2.5
|
||||
// Project: http://mochajs.org/
|
||||
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>, otiai10 <https://github.com/otiai10>, jt000 <https://github.com/jt000>, Vadim Macagon <https://github.com/enlight>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface MochaSetupOptions {
|
||||
//milliseconds to wait before considering a test slow
|
||||
slow?: number;
|
||||
|
||||
// timeout in milliseconds
|
||||
timeout?: number;
|
||||
|
||||
// ui name "bdd", "tdd", "exports" etc
|
||||
ui?: string;
|
||||
|
||||
//array of accepted globals
|
||||
globals?: any[];
|
||||
|
||||
// reporter instance (function or string), defaults to `mocha.reporters.Spec`
|
||||
reporter?: any;
|
||||
|
||||
// bail on the first test failure
|
||||
bail?: boolean;
|
||||
|
||||
// ignore global leaks
|
||||
ignoreLeaks?: boolean;
|
||||
|
||||
// grep string or regexp to filter tests with
|
||||
grep?: any;
|
||||
}
|
||||
|
||||
interface MochaDone {
|
||||
(error?: Error): void;
|
||||
}
|
||||
|
||||
declare var mocha: Mocha;
|
||||
declare var describe: Mocha.IContextDefinition;
|
||||
declare var xdescribe: Mocha.IContextDefinition;
|
||||
// alias for `describe`
|
||||
declare var context: Mocha.IContextDefinition;
|
||||
// alias for `describe`
|
||||
declare var suite: Mocha.IContextDefinition;
|
||||
declare var it: Mocha.ITestDefinition;
|
||||
declare var xit: Mocha.ITestDefinition;
|
||||
// alias for `it`
|
||||
declare var test: Mocha.ITestDefinition;
|
||||
|
||||
declare function before(action: () => void): void;
|
||||
|
||||
declare function before(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function setup(action: () => void): void;
|
||||
|
||||
declare function setup(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function after(action: () => void): void;
|
||||
|
||||
declare function after(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function teardown(action: () => void): void;
|
||||
|
||||
declare function teardown(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function beforeEach(action: () => void): void;
|
||||
|
||||
declare function beforeEach(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function suiteSetup(action: () => void): void;
|
||||
|
||||
declare function suiteSetup(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function afterEach(action: () => void): void;
|
||||
|
||||
declare function afterEach(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function suiteTeardown(action: () => void): void;
|
||||
|
||||
declare function suiteTeardown(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare class Mocha {
|
||||
constructor(options?: {
|
||||
grep?: RegExp;
|
||||
ui?: string;
|
||||
reporter?: string;
|
||||
timeout?: number;
|
||||
bail?: boolean;
|
||||
});
|
||||
|
||||
/** Setup mocha with the given options. */
|
||||
setup(options: MochaSetupOptions): Mocha;
|
||||
bail(value?: boolean): Mocha;
|
||||
addFile(file: string): Mocha;
|
||||
/** Sets reporter by name, defaults to "spec". */
|
||||
reporter(name: string): Mocha;
|
||||
/** Sets reporter constructor, defaults to mocha.reporters.Spec. */
|
||||
reporter(reporter: (runner: Mocha.IRunner, options: any) => any): Mocha;
|
||||
ui(value: string): Mocha;
|
||||
grep(value: string): Mocha;
|
||||
grep(value: RegExp): Mocha;
|
||||
invert(): Mocha;
|
||||
ignoreLeaks(value: boolean): Mocha;
|
||||
checkLeaks(): Mocha;
|
||||
/** Enables growl support. */
|
||||
growl(): Mocha;
|
||||
globals(value: string): Mocha;
|
||||
globals(values: string[]): Mocha;
|
||||
useColors(value: boolean): Mocha;
|
||||
useInlineDiffs(value: boolean): Mocha;
|
||||
timeout(value: number): Mocha;
|
||||
slow(value: number): Mocha;
|
||||
enableTimeouts(value: boolean): Mocha;
|
||||
asyncOnly(value: boolean): Mocha;
|
||||
noHighlighting(value: boolean): Mocha;
|
||||
/** Runs tests and invokes `onComplete()` when finished. */
|
||||
run(onComplete?: (failures: number) => void): Mocha.IRunner;
|
||||
}
|
||||
|
||||
// merge the Mocha class declaration with a module
|
||||
declare module Mocha {
|
||||
/** Partial interface for Mocha's `Runnable` class. */
|
||||
interface IRunnable {
|
||||
title: string;
|
||||
fn: Function;
|
||||
async: boolean;
|
||||
sync: boolean;
|
||||
timedOut: boolean;
|
||||
}
|
||||
|
||||
/** Partial interface for Mocha's `Suite` class. */
|
||||
interface ISuite {
|
||||
parent: ISuite;
|
||||
title: string;
|
||||
|
||||
fullTitle(): string;
|
||||
}
|
||||
|
||||
/** Partial interface for Mocha's `Test` class. */
|
||||
interface ITest extends IRunnable {
|
||||
parent: ISuite;
|
||||
pending: boolean;
|
||||
|
||||
fullTitle(): string;
|
||||
}
|
||||
|
||||
/** Partial interface for Mocha's `Runner` class. */
|
||||
interface IRunner {}
|
||||
|
||||
interface IContextDefinition {
|
||||
(description: string, spec: () => void): ISuite;
|
||||
only(description: string, spec: () => void): ISuite;
|
||||
skip(description: string, spec: () => void): void;
|
||||
timeout(ms: number): void;
|
||||
}
|
||||
|
||||
interface ITestDefinition {
|
||||
(expectation: string, assertion?: () => void): ITest;
|
||||
(expectation: string, assertion?: (done: MochaDone) => void): ITest;
|
||||
only(expectation: string, assertion?: () => void): ITest;
|
||||
only(expectation: string, assertion?: (done: MochaDone) => void): ITest;
|
||||
skip(expectation: string, assertion?: () => void): void;
|
||||
skip(expectation: string, assertion?: (done: MochaDone) => void): void;
|
||||
timeout(ms: number): void;
|
||||
}
|
||||
|
||||
export module reporters {
|
||||
export class Base {
|
||||
stats: {
|
||||
suites: number;
|
||||
tests: number;
|
||||
passes: number;
|
||||
pending: number;
|
||||
failures: number;
|
||||
};
|
||||
|
||||
constructor(runner: IRunner);
|
||||
}
|
||||
|
||||
export class Doc extends Base {}
|
||||
export class Dot extends Base {}
|
||||
export class HTML extends Base {}
|
||||
export class HTMLCov extends Base {}
|
||||
export class JSON extends Base {}
|
||||
export class JSONCov extends Base {}
|
||||
export class JSONStream extends Base {}
|
||||
export class Landing extends Base {}
|
||||
export class List extends Base {}
|
||||
export class Markdown extends Base {}
|
||||
export class Min extends Base {}
|
||||
export class Nyan extends Base {}
|
||||
export class Progress extends Base {
|
||||
/**
|
||||
* @param options.open String used to indicate the start of the progress bar.
|
||||
* @param options.complete String used to indicate a complete test on the progress bar.
|
||||
* @param options.incomplete String used to indicate an incomplete test on the progress bar.
|
||||
* @param options.close String used to indicate the end of the progress bar.
|
||||
*/
|
||||
constructor(runner: IRunner, options?: {
|
||||
open?: string;
|
||||
complete?: string;
|
||||
incomplete?: string;
|
||||
close?: string;
|
||||
});
|
||||
}
|
||||
export class Spec extends Base {}
|
||||
export class TAP extends Base {}
|
||||
export class XUnit extends Base {
|
||||
constructor(runner: IRunner, options?: any);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "mocha" {
|
||||
export = Mocha;
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
// Type definitions for morgan 1.2.2
|
||||
// Project: https://github.com/expressjs/morgan
|
||||
// Definitions by: James Roland Cabresos <https://github.com/staticfunction>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
declare module "morgan" {
|
||||
|
||||
import express = require('express');
|
||||
|
||||
module morgan {
|
||||
|
||||
export function token<T>(name: string, callback: (req: express.Request, res: express.Response) => T): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Morgan accepts these properties in the options object.
|
||||
*/
|
||||
export interface Options {
|
||||
|
||||
/***
|
||||
* Buffer duration before writing logs to the stream, defaults to false. When set to true, defaults to 1000 ms.
|
||||
*/
|
||||
buffer?: boolean;
|
||||
|
||||
/***
|
||||
* Write log line on request instead of response. This means that a requests will be logged even if the server crashes, but data from the response cannot be logged (like the response code).
|
||||
*/
|
||||
immediate?: boolean;
|
||||
|
||||
/***
|
||||
* Function to determine if logging is skipped, defaults to false. This function will be called as skip(req, res).
|
||||
*/
|
||||
skip?: (req: express.Request, res: express.Response) => boolean;
|
||||
|
||||
/***
|
||||
* Output stream for writing log lines, defaults to process.stdout.
|
||||
* @param str
|
||||
*/
|
||||
stream?: (str: string) => void;
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* Create a new morgan logger middleware function using the given format and options. The format argument may be a string of a predefined name (see below for the names), a string of a format string, or a function that will produce a log entry.
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: string, options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Standard Apache combined log output.
|
||||
* :remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: 'combined', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Standard Apache common log output.
|
||||
* :remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length]
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: 'common', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Concise output colored by response status for development use. The :status token will be colored red for server error codes, yellow for client error codes, cyan for redirection codes, and uncolored for all other codes.
|
||||
* :method :url :status :response-time ms - :res[content-length]
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: 'dev', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Shorter than default, also including response time.
|
||||
* :remote-addr :remote-user :method :url HTTP/:http-version :status :res[content-length] - :response-time ms
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: 'short', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* The minimal output.
|
||||
* :method :url :status :res[content-length] - :response-time ms
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: 'tiny', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
function morgan(custom: (req: express.Request, res: express.Response) => string): express.RequestHandler
|
||||
|
||||
export = morgan;
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,29 @@
|
|||
// Type definitions for serve-favicon 2.1.6
|
||||
// Project: https://github.com/expressjs/serve-favicon
|
||||
// Definitions by: Uros Smolnik <https://github.com/urossmolnik/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/* =================== USAGE ===================
|
||||
|
||||
import serveFavicon = require('serve-favicon');
|
||||
app.use(serveFavicon(__dirname + '/public/favicon.ico'));
|
||||
|
||||
=============================================== */
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module "serve-favicon" {
|
||||
import express = require('express');
|
||||
|
||||
/**
|
||||
* Node.js middleware for serving a favicon.
|
||||
*/
|
||||
function serveFavicon(path: string, options?: {
|
||||
/**
|
||||
* The cache-control max-age directive in ms, defaulting to 1 day. This can also be a string accepted by the ms module.
|
||||
*/
|
||||
maxAge?: number;
|
||||
}): express.RequestHandler;
|
||||
|
||||
export = serveFavicon;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<!--
|
||||
Press Ctrl+Shift+V (Windows, Linux) or Cmd+Shift+V (OSX) to preview this document!
|
||||
-->
|
||||
|
||||
# Getting Started with Node, Express and Visual Studio Code
|
||||
This is an [express-generator](http://expressjs.com/starter/generator.html) generated sample customized for development using [Visual Studio Code](http://code.visualstudio.com) and [TypeScript](http://www.typescriptlang.org/).
|
||||
|
||||
This example illustrates:
|
||||
- **Great IntelliSense**: [TypeScript definition files](https://github.com/borisyankov/DefinitelyTyped) provide IntelliSense for Node, Express, Mocha, and Gulp. Use [tsd](http://definitelytyped.org/tsd/) to install additional typings.
|
||||
|
||||
- **Iterative Development**: Use [BrowserSync](http://www.browsersync.io/) and [NodeMon](http://nodemon.io/) to automatically recycle your client and server while developing in Visual Studio Code. Run `gulp browser-sync` from the Terminal.
|
||||
|
||||
- **Build**: Compile your [TypeScript](http://typescriptlang.org/) files to JavaScript by pressing `Ctrl+Shift+B` (Windows, Linux) or `Cmd+Shift+B` (OS X). You can also let gulp watch for file changes and automatically build by running `gulp watch` from the terminal.
|
||||
|
||||
- **StyleSheets**: [LESS](http://lesscss.org/) is a CSS pre-processor that extends CSS to allow for typical programming construcs such as variables, mixins, and functions. To compile your .less file to .css press `Ctrl+P` (Windows, Linux) or `Cmd+P` (OS X) to bring up the Command Palette, and then type in `task less`.
|
||||
|
||||
- **Test**: [Mocha](http://mochajs.org/) is a popular test framework for Node applications. Press `Ctrl+Shift+T` (Windows, Linux) or `Cmd+Shift+T` (OS X) to run the tests.
|
||||
|
||||
- **Debugging**: [Launch Configurations](https://code.visualstudio.com/Docs/debugging) are used for running your application under the debugger as well as launching the Mocha tests under the debugger. Open the Debug viewlet, select `Launch ./src/www` and press `F5` to run the application.
|
||||
|
||||
- **Integration with existing tools**: [Task Configurations](https://code.visualstudio.com/Docs/tasks) allow for control over how individual [Gulp](http://gulpjs.com/) tasks are launched. Run individual tasks from the Command Palette by pressing `Ctrl+P` (Windows, Linux) or `Cmd+P` (OS X), type in `task` and then press `space` to see all of the tasks in the provided `gulpfile.js`.
|
||||
|
||||
For more information, please visit us at [code.visualstudio.com](http://code.visualstudio.com), read the [documentation](http://code.visualstudio.com/docs) and follow us on twitter [@code](https://twitter.com/code).
|
Загрузка…
Ссылка в новой задаче