express load a page
const express = require('express');
const app = express();
const path = require('path');
const router = express.Router();
router.get('/',function(req,res){
res.sendFile(path.join(__dirname, '/index.html'));
//__dirname : It will resolve to your project folder.
});
// To go back a folder from __dirname
router.get('/about',function(req,res){
res.sendFile(path.join(__dirname, '../somefolder/about.html'));
});
Also in JavaScript:
- gatsby-plugin-create-client-paths
- react context api
- react app cloud foundry 404
- how to use function in javascript
- Unterminated quote at columns 0-8 ['MM-yyyy] in expression ['MM-yyyy]
- how to get only citnames in google maps api js
- single node elasticsearch with enable security basic in docker
- componentWillUnmount functional component for asynchronous requests
- javascript confirm yes no
- react native text area form
- face-api.js
- not getting webhook post request json data in my laravel controller
- jquery selector parent on hover
- ModuleBuildError: Module build failed (from ./node_modules/sass-loader/lib/loader.js): Error: ENOENT: no such file or directory, scandir
- javascript regex extract url from string
- clear all intervals javascript
- regular expression to remove empty lines after text
- how to make apk react native
- instantiate js
- mysql JSON_SEARCH LIKE
- javascript array merge
- js array find regex
- node js with express medium
- nested array loop in javascript