Code Monkey home page Code Monkey logo

dimitrov-adrian / directus-extension-linkmeta Goto Github PK

View Code? Open in Web Editor NEW
27.0 2.0 5.0 1.08 MB

Directus 9 extension that stores link metadata using Open Graph, JSON+LD, oEmbed or HTML metadata

Home Page: https://www.npmjs.com/package/directus-extension-linkmeta

License: GNU General Public License v3.0

JavaScript 35.89% Vue 44.03% TypeScript 20.08%
directus-extension directus directus-extension-interface directus-extension-endpoint link-preview metascrape directus-link

directus-extension-linkmeta's People

Contributors

dimitrov-adrian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

directus-extension-linkmeta's Issues

Extension interfaces do not appear in field configuration

Hi,

I just installed the plugin and restarted Directus :

directus_1  | 10:59:49 ✨ Loaded extensions: directus-extension-linkmeta, directus-extension-linkmeta-endpoint, directus-extension-linkmeta-interface
directus_1  | 10:59:49 ✨ Initializing bootstrap...
directus_1  | 10:59:49 ✨ Database already initialized, skipping install
directus_1  | 10:59:49 ✨ Running migrations...
directus_1  | 10:59:49 ✨ Done
directus_1  | 10:59:51 ✨ Loaded extensions: directus-extension-linkmeta, directus-extension-linkmeta-endpoint, directus-extension-linkmeta-interface
directus_1  | 10:59:51 ⚠️  PUBLIC_URL should be a full URL
directus_1  | 10:59:51 ✨ Server started at http://0.0.0.0:8055

Created a new standard field with JSON type :

image

Extension's interfaces do not show up :

image

Instance is running Directus 9.12.2

Endpoint extension loading but route doesn't work

i am developing an endpoint extension. it is loading properly but it when I try to hit through browser or or curl command it is throwing an error

"errors": [
{
"message": "Route /trigger-device-discovery doesn't exist.",
"extensions": {
"code": "ROUTE_NOT_FOUND",
"path": "/trigger-device-discovery"
}
}
]

extension index.js file

module.exports = {
id: 'device-discovery',
handler: (router, { services, exceptions, logger }) => {
const { ItemsService } = services;

  async function discoverDevices() {
	// Replace with actual discovery logic
	return [
	  { id: 1, status: 'active', device_name: 'Device 1', ip_address: '192.168.1.1' },
	  { id: 2, status: 'inactive', device_name: 'Device 2', ip_address: '192.168.1.2' },
	];
  }

  async function updateControllerCollection() {
	const itemsService = new ItemsService('controller');

	try {
	  const devices = await discoverDevices();

	  for (const device of devices) {
		await itemsService.createOne(device);
	  }

	  logger.info('Devices successfully stored in the controller collection.');
	} catch (error) {
	  logger.error('Error storing devices in the controller collection:', error);
	}
  }

  router.post('/', async (req, res) => {
	try {
	  await updateControllerCollection();
	  res.status(200).send({ message: 'Device discovery triggered successfully.' });
	} catch (error) {
	  logger.error('Error triggering device discovery:', error);
	  res.status(500).send({ message: 'Error triggering device discovery.' });
	}
  });
},

};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.