I hereby claim:
- I am gunnigylfa on github.
- I am gunnigylfa (https://keybase.io/gunnigylfa) on keybase.
- I have a public key ASCTBh2x_R_vTOFyKNFRVBdvPQv79wUtLRylZvnibEjjKgo
To claim this, I am signing this object:
let routeConfig: StackNavigatorRe.routesConfig = { | |
"main": { | |
"screen": Main.jsComponent, | |
"navigationOptions": { | |
"title": "", | |
}, | |
}, | |
"modal": { | |
"screen": Modal.jsComponent, | |
"navigationOptions": { |
I hereby claim:
To claim this, I am signing this object:
// DELETE '/v1/heores/' Delete hero entry | |
api.delete('/:id', (req, res) => { | |
Hero.remove({ | |
__id: req.params.id, | |
}, (err) => { | |
if (err) { | |
return res.send(err); | |
} | |
return res.json({ | |
message: 'Hero successfully removed', |
// PUT '/v1/heroes' Update hero entry | |
api.put('/:id', (req, res) => { | |
Hero.findById(req.params.id, (err, hero) => { | |
if (err) { | |
return res.send(err); | |
} | |
hero.name = req.body.name; | |
hero.secretIdentity = req.body.name; | |
return hero.save((saveErr, savedHero) => { |
// GET '/v1/heroes/:id' Get (Read) a specific heroe by ObjectId | |
api.get('/:id', (req, res) => { | |
Hero.findById(req.params.id, (err, hero) => { | |
if (err) { | |
return res.send(err); | |
} | |
return res.json(hero); | |
}); | |
}); |
// GET '/v1/heroes' Get (Read) all heroes | |
api.get('/', (req, res) => { | |
Hero.find({}, (err, heroes) => { | |
if (err) { | |
return res.send(err); | |
} | |
return res.json(heroes); | |
}); | |
}); |
// POST '/v1/heroes' Create new hero entry | |
api.post('/', (req, res) => { | |
// Create a new blank Hero model | |
const newHero = new Hero(); | |
// Fetch hero properties from the request body | |
newHero.name = req.body.name; | |
newHero.secretIdentity = req.body.secretIdentity; | |
// Save it in our database | |
newHero.save((err, hero) => { | |
if (err) { |
import { Router } from 'express'; | |
import Hero from '../models/hero'; | |
export default () => { | |
const api = Router(); | |
// POST '/v1/heroes' Create new hero entry | |
// GET '/v1/heroes' Get (Read) all heroes |
import express from 'express'; | |
import bodyParser from 'body-parser'; | |
import config from './config'; | |
import routes from './routes'; | |
const app = express(); | |
/* | |
* Send out a welcome message when the user hits our |