jellyo-express-template
v1.0.5
Published
Template for expressjs app
Downloads
1
Readme
express-template
This is a basic Express.js application generated using Express Generator. It sets up a simple application with an organized directory structure and pre-configured middleware.
Getting Started
To get started, first install all the necessary dependencies.
npm install
Add in the following:
In config.mjs (if you are using MongoDB in your project):
export const config = {
database: {
url: "",
}
};
In app.mjs (if you require sessions in your project):
app.use(
session({
secret: "",
resave: false,
saveUninitialized: true,
cookie: { secure: "auto" }
})
);
Start the development server:
npm run dev
By default, browser-sync starts the server on http://localhost:3000
. Browser-sync maps the port your server is listening on to port 3000.
Start the server without nodemon or browser-sync:
npm start
This starts a server on localhost
, on the port that your node server is listening on.
File Structure
Here is the main structure of the project:
.
├── app.mjs
├── config.mjs
├── package.json
├── public
│ ├── img
│ ├── js
└── script.js
│ └── css
│ └── styles.css
├── routes
│ ├── index.js
└── views
├── index.ejs
Scripts
npm start
: Runsnode app.mjs
npm run nodemon
: Runsnodemon -e * app.mjs
; Refreshes the server on savenpm run sync
: Runsbrowser-sync
; Refreshes browser on savenpm run dev
: Combines both nodemon and browser-sync
License
MIT License
Copyright (c) 2023 Jellyyyyyyy