kiro-app-gen
v1.0.6
Published
It generates a ready to use node app based on mongoose models
Downloads
12
Maintainers
Readme
This is a beta version !
Give it a mongoose models folder and it will give you back a ready to use node app with authentication system and an api
The app will be based on the following modules
- Express and express-session
- Ejs
- Passport
- mongoose
- kiro-rvcgen and kiro-passport
Step 1 - run
npm i kiro-app-gen
Step 2 - make sure you have (in app root folder) a ./models folder that contains a valid mongoose models files; For better results each models must be in a separated file and starts with a capital letter, example : User.js , Product.js ...
Step 3 - create a file named generator.js and add the following
const generateApp = require("kiro-app-gen") ;
generateApp();
Step 3 - run the generator
node generator
Step 4 - This will create
- auth folder in you app with required files
- auth.js controller file in ./controllers/Auth.js
- auth.js route in ./routes/auth.js
- routes-inc.js in ./routes/routes-inc.js
- foreach mogoose folder it will create controllers, routes and basic views files
- ./config/db.js for database credentials
- server.js file to start the app
Step 5 - Edit ./config/db.js with your database informations
Step 6 - run the server
node server
Step 7 - by default the app will start at http://localhost:2000
Infos - Here are some usefull routes thar were generated
- http://localhost:2000/auth/login
- http://localhost:2000/YOUR_MODEL_NAME/list
- http://localhost:2000/api/YOUR_MODEL_NAME/list
- http://localhost:2000/YOUR_MODEL_NAME/YOUR_MODEL_ID
That's it !