Initial server blockout
This commit is contained in:
parent
eaa38cf6c1
commit
a674d4f082
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
|
config/secrets.json
|
||||||
|
@ -2,3 +2,8 @@
|
|||||||
Automation tool to reduce pain while taking CGT365
|
Automation tool to reduce pain while taking CGT365
|
||||||
|
|
||||||
- [Atlassian NPM module](https://bitbucket.org/atlassian/atlassian-connect-express/src/master/)
|
- [Atlassian NPM module](https://bitbucket.org/atlassian/atlassian-connect-express/src/master/)
|
||||||
|
- [Jira REST API](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#about)
|
||||||
|
- API Tokens can be generated [here](https://id.atlassian.com/manage-profile/security/api-tokens)
|
||||||
|
- Tips on [managing API tokens](https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/)
|
||||||
|
- [PatternPacker](https://git.alanocull.com/alan/pattern-packer/src/branch/master/src/server/server.ts) uses some basic express hosting
|
||||||
|
- Jira REST API docs for [issues](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-group-issues)
|
||||||
|
3
config/server.json
Normal file
3
config/server.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"port": 3001
|
||||||
|
}
|
@ -4,6 +4,7 @@
|
|||||||
"description": "Tool for basic mirroring issues, tasks, and commits between Gitea and Jira",
|
"description": "Tool for basic mirroring issues, tasks, and commits between Gitea and Jira",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"server": "node ./src/index.js",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
22
src/index.js
Normal file
22
src/index.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const express = require('express');
|
||||||
|
const { append } = require('express/lib/response');
|
||||||
|
|
||||||
|
// LOAD CONFIGURATION
|
||||||
|
const CONFIG_DIRECTORY = `${process.cwd()}/config/`;
|
||||||
|
/** @var {Object} */
|
||||||
|
const CONFIG = JSON.parse(fs.readFileSync(`${CONFIG_DIRECTORY}server.json`, 'utf-8'));
|
||||||
|
const SECRETS = JSON.parse(fs.readFileSync(`${CONFIG_DIRECTORY}secrets.json`, 'utf-8'));
|
||||||
|
const PORT = CONFIG['port'];
|
||||||
|
|
||||||
|
// INITIALIZE EXPRESS
|
||||||
|
const app = express();
|
||||||
|
|
||||||
|
app.get('/', (req, res) => {
|
||||||
|
console.log("Got request ", req.url);
|
||||||
|
res.send({'data':'nice'});
|
||||||
|
})
|
||||||
|
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`Server is running on localhost:${PORT}, working in ${CONFIG_DIRECTORY}`)
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user