UNPKG

basic-express-app

Version:

simple cli to generate a basic express scaffolding with minimal tmplate

34 lines (26 loc) 593 B
/** @format */ const { writeFileSync } = require("fs") const serverGen = (cwd) => writeFileSync( cwd + `/index.js`, `const express = require("express") require("dotenv").config() const app = express() //middleware app.use(express.json()) app.get("/", (req, res) => { res.send("Hello world") }) const PORT = process.env.PORT || 5001 app.listen(PORT, () => console.log(\`server running on \${PORT}\`))` ) const gitIgnoreGen = (cwd) => writeFileSync( cwd + `/.gitignore`, `/node_modules ./env.local` ) module.exports = { serverGen, gitIgnoreGen, }