ExpressJs
To open the program, follow these steps:
1. To run the server you need to make sure you have installed package express,
and if you haven't and don't know how you need node.js and then type in your console:
$ npm install express
2. After completing the above steps, open the file named start.bat and see your three options.
server.js
const {
example } = require('./config.json'), // Redirects
express = require('express'), // Server Import #1
app = express(), // Server Import #2
path = require('path'), // Server Import #3
fs = require('fs'); // Server Import #4
app.use(express(__dirname));
app.set('view engine', 'html'); // Engine
app.listen(3000, () => { // Port
console.log(`App listening port:3000`) // Console
}); // Host
app.use('/', express.static(path.join(__dirname, '/'))) // Stylesheets and JavaScript
app.get("/example", (req, res) => { // Link Connector
res.status(301).redirect(`${linkhere}`) // Redirect Link
});
app.get('/home', function (req, res) { // Page Link
res.sendFile(path.join(__dirname + '/index.html')); // Home Page
});
app.use((req, res, next) => { // Connector
res.status(404).sendFile(path.join(__dirname + '/404.html')); // 404 Page
}); // End
You like what you see?
Drop me a message and let’s turn your dreams into reality