Skip to content

Latest commit

 

History

History
35 lines (31 loc) · 841 Bytes

File metadata and controls

35 lines (31 loc) · 841 Bytes
  • Put command npm init and add server.js as starting point.
  • Run npm i nodemon express dotenv chalk morgan
  • Add "start": "nodemon server.js", in the scripts
  • Add following script at the end of package.json file
"engines": {
    "node": ">=10.0.0"
}
  • Add .gitignore file and add
/node_modules/
*.env
  • Add .env & .sample-env files
  • Create index.js file and add basic server starting code. eg: 👇
const express = require('express');
const app = express();

console.log('✅ App Started');

const port = process.env.PORT || 3000;

app.get('/api/v1/books', (req, res) => {
    res.status(200).json({
        'status': 'success',
        'message': 'Everything is working correct'
    });
});

app.listen(port, () => {
    console.log(`✅ Server started at http://localhost:${port}`);
});