-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
27 lines (27 loc) · 924 Bytes
/
server.js
File metadata and controls
27 lines (27 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
* Created by Gordon Barrs on 11/08/2015.
*/
/// <reference path="type_definitions\express\express.d.ts"/>
/// <reference path="type_definitions\body-parser\body-parser.d.ts"/>
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
// Tell app to use bodyParser.
// This will allow us to process data from a POST request
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
//Set the port on which the app will listen
var port = process.env.PORT || 80;
//Set the response to be returned when requesting the root of the service
var router = express.Router();
// All routes will be prefixed with 'api'
app.use('/api', router);
router.get('/', function (request, response) {
response.json({
serviceName: "My Service",
version: "v0.1.0"
});
});
app.listen(port);
console.log('Server running ...');
//# sourceMappingURL=server.js.map