Bläddra i källkod

initial commit 2

master
Bruno FELIX 2 år sedan
förälder
incheckning
e6e5d41264
4 ändrade filer med 75 tillägg och 0 borttagningar
  1. +11
    -0
      .drone.yml
  2. +33
    -0
      .gitignore
  3. +11
    -0
      server.js
  4. +20
    -0
      spec.js

+ 11
- 0
.drone.yml Visa fil

@@ -0,0 +1,11 @@
pipeline:
build:
image: node
commands:
- npm install
- npm test
publish:
image: plugins/docker
repo: drone/node-demo
secrets: [ docker_username, docker_password ]
dry_run: true # remove this to publish

+ 33
- 0
.gitignore Visa fil

@@ -0,0 +1,33 @@
# Logs
logs
*.log
npm-debug.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
node_modules

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

+ 11
- 0
server.js Visa fil

@@ -0,0 +1,11 @@
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.status(200).send('ok');
});
var server = app.listen(3000, function () {
var port = server.address().port;
console.log('Example app listening at port %s', port);
});
module.exports = server;


+ 20
- 0
spec.js Visa fil

@@ -0,0 +1,20 @@
var request = require('supertest');
describe('loading express', function () {
var server;
beforeEach(function () {
server = require('./server');
});
afterEach(function () {
server.close();
});
it('responds to /', function testSlash(done) {
request(server)
.get('/')
.expect(200, done);
});
it('404 everything else', function testPath(done) {
request(server)
.get('/foo/bar')
.expect(404, done);
});
});

Laddar…
Avbryt
Spara

Powered by TurnKey Linux.