Plugins

  • The plugin directory is located in src/plugins, how to implement a simple plugin
exports.plugin  = {
    name: 'testExample',
    register: async (server) =>{
         server.route({
            method: 'GET',
            path: '/testExample',
            handler: function (request, h) {
                return 'hello, world';
            }
        });
        // server.ext('onRequest', async function (request, h) {
        //     //...code
        //     console.log(request.path)
        //     return h.continue;
        // });
    }
}

Next step

cors cross-domain request