Kharis Khasburrahman#5
Conversation
tambah keterangan alamat deploy
|
ini udah diupdate mas @WikaSilo deploy di: https://kecebadai.khariskhasburrahman.com fitur tambahan: dibuat routing jadi jadian, bisa ngarah ke blog atau halaman untuk admin |
| * pre route middleware | ||
| */ | ||
| app.use(cors()) | ||
| app.use(mongoMiddleware) |
There was a problem hiding this comment.
sebaiknya jangan dibuat middleware yaa, karena nanti connectionnya terbuka terus
| @@ -0,0 +1,3 @@ | |||
| module.exports = (err, req, res, next) => { | |||
| res.status(err.code || 500).send(err.msg || err.message) | |||
There was a problem hiding this comment.
akan lebih baik juga validation error di handle karna bisa jadi lebih dari satu error
| res.json({_id, email, password}) | ||
| } catch (err) { | ||
| console.log('register error', err) | ||
| if (err.code === 11000){ |
There was a problem hiding this comment.
ini yang duplicate dari index mongo db mas
https://stackoverflow.com/questions/18032879/mongodb-difference-between-error-code-11000-and-11001
|
Mas wika, yang mongo connection duplicate barusan di push, |
No description provided.