-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
4,472 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch", | ||
"type": "node", | ||
"request": "launch", | ||
"program": "${workspaceRoot}/dist/index.js", | ||
"stopOnEntry": false, | ||
"args": [], | ||
"cwd": "${workspaceRoot}", | ||
"preLaunchTask": null, | ||
"runtimeExecutable": null, | ||
"runtimeArgs": [ | ||
"--nolazy" | ||
], | ||
"env": { | ||
"NODE_ENV": "development" | ||
}, | ||
"externalConsole": false, | ||
"sourceMaps": false, | ||
"outDir": null | ||
}, | ||
{ | ||
"name": "Attach", | ||
"type": "node", | ||
"request": "attach", | ||
"port": 5858, | ||
"address": "localhost", | ||
"restart": false, | ||
"sourceMaps": false, | ||
"outDir": null, | ||
"localRoot": "${workspaceRoot}", | ||
"remoteRoot": null | ||
}, | ||
{ | ||
"name": "Attach to Process", | ||
"type": "node", | ||
"request": "attach", | ||
"processId": "${command.PickProcess}", | ||
"port": 5858, | ||
"sourceMaps": false, | ||
"outDir": null | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "0.1.0", | ||
"command": "gulp", | ||
"isShellCommand": true, | ||
"args": [ | ||
"--no-color" | ||
], | ||
"tasks": [ | ||
{ | ||
"taskName": "default", | ||
"isBuildCommand": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"use strict"; | ||
var express = require("express"); | ||
var bodyParser = require("body-parser"); | ||
var app = express(); | ||
app.use(bodyParser.urlencoded({ extended: true })); | ||
app.use(bodyParser.json()); | ||
var port = process.env.PORT || 8080; | ||
var switch_status = true; | ||
var router = express.Router(); | ||
router.post('/login', function (req, res) { | ||
res.json({ token: 'youmadeit' }); | ||
}); | ||
router.get('/switch', function (req, res) { | ||
res.json({ status: switch_status }); | ||
}); | ||
router.post('/switch', function (req, res) { | ||
switch_status = req.body.status; | ||
res.json({ status: switch_status }); | ||
}); | ||
app.use('/', router); | ||
app.listen(port); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var gulp = require("gulp"); | ||
var ts = require("gulp-typescript"); | ||
var tsProject = ts.createProject("tsconfig.json"); | ||
|
||
gulp.task("default", function () { | ||
return tsProject.src() | ||
.pipe(ts(tsProject)) | ||
.js.pipe(gulp.dest("dist")); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "smartbnbkit-backend", | ||
"version": "1.0.0", | ||
"description": "The backend API for Toptal's Open Source Rental-Economy Hardware Kit", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/smartbnbkit/backend.git" | ||
}, | ||
"keywords": [ | ||
"hardware", | ||
"iot", | ||
"backend" | ||
], | ||
"author": "The Toptal Hardware Community", | ||
"license": "GPL-3.0", | ||
"bugs": { | ||
"url": "https://github.com/smartbnbkit/backend/issues" | ||
}, | ||
"homepage": "https://github.com/smartbnbkit/backend#readme", | ||
"dependencies": { | ||
"body-parser": "^1.15.2", | ||
"express": "^4.14.0" | ||
}, | ||
"devDependencies": { | ||
"gulp": "^3.9.1", | ||
"gulp-typescript": "^2.13.6", | ||
"typescript": "^1.8.10" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"use strict"; | ||
|
||
import express = require("express"); | ||
import bodyParser = require("body-parser"); | ||
|
||
let app = express(); | ||
|
||
app.use(bodyParser.urlencoded({ extended: true })); | ||
app.use(bodyParser.json()); | ||
|
||
var port = process.env.PORT || 8080; | ||
|
||
let switch_status = true; | ||
|
||
var router = express.Router(); | ||
router.post('/login', function(req, res) { | ||
res.json({ token: 'youmadeit' }); | ||
}); | ||
router.get('/switch', function(req, res) { | ||
res.json({ status: switch_status }); | ||
}); | ||
router.post('/switch', function(req, res) { | ||
switch_status = req.body.status; | ||
res.json({ status: switch_status }); | ||
}); | ||
|
||
app.use('/', router); | ||
app.listen(port); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "es5", | ||
"noImplicitAny": false, | ||
"sourceMap": false | ||
}, | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "smartbnbkit-backend", | ||
"dependencies": {} | ||
} |
Oops, something went wrong.