Skip to content

Instantly share code, notes, and snippets.

@nitish24p nitish24p/index.js
Last active Jun 26, 2018

Embed
What would you like to do?
index.js for sever
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const userController = require('./userController');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.post('/user', userController.createOrAddUser);
app.use((err, req, res, next) => {
res
.status(err.status || 500)
.send({ status: err.status ? `${err.status}` : 500, message: err.message });
});
app.listen(3000, () => {
console.log('listening on port 3000');
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.