This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = app => { | |
app.get('/pets', (req, res) => { | |
res.status(200).send({message: 'listing pets'}); | |
}); | |
app.post('/pets', (req, res) => { | |
res.status(201).send({message: 'creating a pet'}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const helmet = require('helmet'); | |
const cors = require('cors'); | |
const consign = require('consign'); | |
const app = express(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: microapi | |
spec: | |
replicas: 5 | |
template: | |
metadata: | |
labels: | |
app: microapi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const Joi = require('joi'); | |
const Boom = require('boom'); | |
const hash = require('take-my-hash'); | |
const cache = require('../configs/cache'); | |
const ProductService = require('../services/products'); | |
module.exports = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const Joi = require('joi'); | |
const Boom = require('boom'); | |
const hash = require('take-my-hash'); | |
const cache = require('../configs/cache'); | |
const ProductService = require('../services/products'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
/** | |
* Detail do produto | |
* Exibe mais detalhes que na listagem geral | |
* Todo produto deve ser identificado pela hash do _id | |
*/ | |
{ | |
method: "GET", | |
path: "/products/{id}", | |
handler: (req, res) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const Joi = require('joi'); | |
const Boom = require('boom'); | |
const Hash = require('take-my-hash'); | |
const cache = require('../configs/cache'); | |
const ProductService = require('../services/products'); | |
module.exports = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const Joi = require('joi'); | |
const Boom = require('boom'); | |
const hash = require('take-my-hash'); | |
const cache = require('../configs/cache'); | |
const ProductsService = require('../services/products'); | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const ProductSchema = require('../models/Products'); | |
const ProductService = { | |
createProduct : productValues => { | |
return new ProductSchema(productValues).save(); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const ProductSchema = require('../models/Products'); | |
const Joi = require('joi'); | |
const Boom = require('boom'); | |
const hash = require('take-my-hash'); | |
const cache = require('../configs/cache'); | |
module.exports = [ |