mjrdnk / express-simple-mvc

Simple starter, bare bone structure based on ExpressJS. Helps easily creating controllers for routes. Provides Flightplan file for simple deployment strategy.
MIT License
12 stars 3 forks source link

[README enhancements] - EXAMPLES section - examples needed #6

Open mjrdnk opened 6 years ago

mjrdnk commented 6 years ago

Would be awesome to have some practical examples added to the README. It could be model, controller, route etc..

abdullateef97 commented 6 years ago

@mjrdnk i would love to help, but can u give an example of practical examples

mjrdnk commented 6 years ago

Hi @abdullateef97 ! Thanks for your interest in express-simple ! Like I mentioned, just an example file.

Here is some controller example with function and exports:

const NodeGeocoder = require('node-geocoder');

const options = {
    provider: 'google',
    httpAdapter: 'https',
    apiKey: process.env.GOOGLE_MAPS_KEY,
    formatter: null
};

const geocoder = NodeGeocoder(options);

function getCoordinates(location) {
    return geocoder.geocode(location)
        .then(
            response => response
        )
        .catch(
            err => console.log('<geocodeController> getCoordinates -> err: ', err)
        );
}

module.exports = {
    getCoordinates,
};
abdullateef97 commented 6 years ago

@mjrdnk added a nexmo example, dont know if thata what u require

abdullateef97 commented 6 years ago

@mjrdnk check out the latest pr