Commit 22741ec9 authored by Zak Stephens's avatar Zak Stephens

Add Config module, HTTPS-only Express app using self-signed certificates locally.

parent 2eed4031
# Vim swap files
*.swp
# Certificates and certificate accessories
keys/
# Logs
logs
*.log
......
{
"tls": {
"certFilePath": "keys/local.crt",
"keyFilePath": "keys/local.key"
},
"port": 8000
}
const config = require('config');
const fs = require('fs');
const https = require('https');
/* */
/* */
const app = require('express')();
app.use('/api/v1', require('./routes'));
const options = {
cert: fs.readFileSync(config.get('tls.certFilePath')),
key: fs.readFileSync(config.get('tls.keyFilePath'))
};
https.createServer(options, app).listen(config.get('port'));
This diff is collapsed.
{
"name": "wayfarers-rest-server",
"version": "1.0.0",
"description": "Backend server for the Wayfarer's Rest (maybe massively?) multiplayer RPG. 100% REST, accepting no compromises.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+ssh://git@gitlab.com/0xc0c0a/wayfarers-rest-server.git"
},
"author": "Zak Stephens",
"bugs": {
"url": "https://gitlab.com/0xc0c0a/wayfarers-rest-server/issues"
},
"homepage": "https://gitlab.com/0xc0c0a/wayfarers-rest-server#readme",
"dependencies": {
"config": "^3.1.0",
"express": "^4.16.4"
},
"private": true
}
const router = require('express').Router();
router.use('/players', require('./players'));
router.use('/snapshots', require('./snapshots'));
module.exports = router;
const router = require('express').Router();
router.post('/', (req, res) => {
// TODO: Create account.
});
router.post('/:username/movements', (req, res) => {
// TODO
});
module.exports = router;
const router = require('express').Router();
router.get('/', (req, res) => {
});
module.exports = router;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment