Ind.ie is now Small Technology Foundation.
Commit 04f55e42 authored by Frauke's avatar Frauke

Added endpoint domain

parent f1bd62af
# magic-website-factory
>
Endpoint:
http://localhost:4040/domain
> Data:
{
"name": "frauke",
"callbackUrl": "http://localhost:3030/ready",
"delay": 5000
}
## About
......
{
"host": "localhost",
"port": 3030,
"port": 4040,
"public": "../public/",
"paginate": {
"default": 10,
......
......@@ -223,6 +223,15 @@
"integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=",
"dev": true
},
"axios": {
"version": "0.17.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.17.1.tgz",
"integrity": "sha1-LY4+XQvb1zJ/kbyBT1xXZg+Bgk0=",
"requires": {
"follow-redirects": "1.4.1",
"is-buffer": "1.1.6"
}
},
"babel-code-frame": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
......@@ -1111,6 +1120,14 @@
"write": "0.2.1"
}
},
"follow-redirects": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.4.1.tgz",
"integrity": "sha512-uxYePVPogtya1ktGnAAXOacnbIuRMB4dkvqeNz2qTtTQsuzSfbDolV+wMMKxAmCx0bLgAKLbBOkjItMbbkR1vg==",
"requires": {
"debug": "3.1.0"
}
},
"forever-agent": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
......@@ -1427,6 +1444,11 @@
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.5.2.tgz",
"integrity": "sha1-1LUFvemUaYfM8PxY2QEP+WB+P6A="
},
"is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
},
"is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
......
/* eslint-disable no-unused-vars */
const axios = require('axios')
class Service {
constructor (options) {
this.options = options || {};
}
async find (params) {
return [];
}
async get (id, params) {
return {
id, text: `A new message with ID: ${id}!`
};
}
async create (data, params) {
setTimeout(() => {
axios.post(data.callbackUrl, { domain: data.domain }).then(() => {
console.log('done')
}).catch((err) => {
console.log(err)
})
}, data.delay)
return data;
}
async update (id, data, params) {
return data;
}
async patch (id, data, params) {
return data;
}
async remove (id, params) {
return { id };
}
}
module.exports = function (options) {
return new Service(options);
};
module.exports.Service = Service;
module.exports = {
before: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
after: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
error: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
}
};
// Initializes the `domain` service on path `/domain`
const createService = require('./domain.class.js');
const hooks = require('./domain.hooks');
module.exports = function (app) {
const paginate = app.get('paginate');
const options = {
name: 'domain',
paginate
};
// Initialize our service with any options it requires
app.use('/domain', createService(options));
// Get our initialized service so that we can register hooks and filters
const service = app.service('domain');
service.hooks(hooks);
};
module.exports = function (app) { // eslint-disable-line no-unused-vars
const domain = require('./domain/domain.service.js');
module.exports = function (app) {
app.configure(domain);
};
const assert = require('assert');
const app = require('../../src/app');
describe('\'domain\' service', () => {
it('registered the service', () => {
const service = app.service('domain');
assert.ok(service, 'Registered the service');
});
});
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