venmjs
Version:
This is a tool 🔧 that can be installed in your terminal at any time ⛏️ it was made for beginners and even for experts, for his utilities, and for a simple creation process 🧨. Every web developer knows how frustrating is to deal with the creation of a ne
24 lines (17 loc) • 613 B
JavaScript
const express = require('express')
const bodyParser = require('body-parser')
const app = express()
// parse requests of content-type - application/json
app.use(bodyParser.json())
// parse requests of content-type - application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: true }))
// simple route
app.get('/', (req, res) => {
res.json({ message: 'Welcome to bezkoder application.' })
})
require('./app/routes/user.routes.js')(app)
// set port, listen for requests
const PORT = process.env.PORT || 3000
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}.`)
})