This commit is contained in:
parent
dbf93d8d1f
commit
4190a23dec
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "volp",
|
"name": "volp",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Visual Online Language Processor",
|
"description": "Open Travel Mapper",
|
||||||
"main": "server.js",
|
"main": "server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
@ -9,7 +9,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git@git.helcel.net:sora/volp.git"
|
"url": "git@git.helcel.net:sora/otm.git"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
const crypto = require('crypto');
|
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
|
|
||||||
|
|
||||||
module.exports = (fastify, opts, done) => {
|
module.exports = (fastify, opts, done) => {
|
||||||
fastify.get('/flight/:id', async (req,reply) => {
|
fastify.get('/flight/:id', async (req,reply) => {
|
||||||
const ENDPOINT = 'https://www.flightradar24.com/v1/search/web/find';
|
const ENDPOINT = 'https://www.flightradar24.com/v1/search/web/find';
|
||||||
@ -20,11 +18,12 @@ module.exports = (fastify, opts, done) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
fastify.get('/:id', (req, reply) => {
|
fastify.get('/:id', async (req, reply) => {
|
||||||
if(req.params.id == undefined){
|
if(req.params.id == undefined){
|
||||||
reply.code(400).send({error:"No ID query parameter"});
|
return reply.code(400).send({error:"No ID query parameter"});
|
||||||
} else {
|
}
|
||||||
fastify.level.get(req.params.id, (err, val) => {
|
|
||||||
|
return fastify.level.db.get(req.params.id, (err, val) => {
|
||||||
if(err){
|
if(err){
|
||||||
console.warn(err);
|
console.warn(err);
|
||||||
reply.send({name:"New Journey", main:[]});
|
reply.send({name:"New Journey", main:[]});
|
||||||
@ -32,14 +31,14 @@ module.exports = (fastify, opts, done) => {
|
|||||||
reply.send(JSON.parse(val));
|
reply.send(JSON.parse(val));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
fastify.post('/:id', (req, reply) => {
|
fastify.post('/:id', async (req, reply) => {
|
||||||
if(req.params.id == undefined){
|
if(req.params.id == undefined){
|
||||||
reply.code(400).send({error:"No ID query parameter"});
|
return reply.code(400).send({error:"No ID query parameter"});
|
||||||
} else {
|
}
|
||||||
fastify.level.put(req.params.id, JSON.stringify(req.body), (err) => {
|
|
||||||
|
return fastify.level.db.put(req.params.id, JSON.stringify(req.body), (err) => {
|
||||||
if(err){
|
if(err){
|
||||||
console.warn(err);
|
console.warn(err);
|
||||||
reply.code(500).send({error:"Error with DB"});
|
reply.code(500).send({error:"Error with DB"});
|
||||||
@ -47,23 +46,22 @@ module.exports = (fastify, opts, done) => {
|
|||||||
reply.send({content:"ok"});
|
reply.send({content:"ok"});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
fastify.delete('/:id',(req, reply) => {
|
// fastify.delete('/:id',(req, reply) => {
|
||||||
if(req.params.id == undefined){
|
// if(req.params.id == undefined){
|
||||||
reply.code(400).send({error:"No ID query parameter"});
|
// reply.code(400).send({error:"No ID query parameter"});
|
||||||
} else {
|
// } else {
|
||||||
fastify.level.delete(req.params.id,(err) => {
|
// fastify.level.delete(req.params.id,(err) => {
|
||||||
if(err){
|
// if(err){
|
||||||
console.warn(err);
|
// console.warn(err);
|
||||||
reply.code(500).send({error:"Error with DB"});
|
// reply.code(500).send({error:"Error with DB"});
|
||||||
} else {
|
// } else {
|
||||||
reply.send({content:"ok"});
|
// reply.send({content:"ok"});
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
const fastify = require('fastify')();//{ logger: true });
|
const fastify = require('fastify')();//{ logger: true });
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const crypto = require('crypto');
|
|
||||||
|
|
||||||
const csass = require("./compile_sass").compileSassMain();
|
const csass = require("./compile_sass").compileSassMain();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user