I am functioning on a little web job and shot to get in addition to the basic routing in node.js & express.The Server start properly and shows every Websites however when walk to the second page to load some (simple) server data the error occurs.

You are watching: Error: no default engine was specified and no extension was provided.

Server password :

const express = require('express'); //importiert refer modul const app = express(); //und bildet eine Express-Application const server = require('http').createServer(app);//importiert http modul und bildet Server /* die dateien (bilder, skripte, css und html dokumente (public ordner)) werden statisch aus dem jeweiligen Verzeichnis geladen kann später therefore "GET localhost/style.css" aufgerufen werden */ app.use(express.static(__dirname + '/public')); app.use('/img', express.static(__dirname + '/public/images')); app.use('/javascript', express.static(__dirname + '/public/javascripts')); app.use('/css', express.static(__dirname + '/public/stylesheets')); /* for this reason wird dice index.html Datei beim Zugriff auf den Server ( ausgegeben dice index.html wird beim Zugriff auf den Server ausgegeben */ app.get('/', function (req, res) res.sendfile(__dirname + '/public/index.html'); ); // record 404 and forward come error handler app.use(function(req, res, next) var err = new Error('Not Found'); err.status = 404; next(err); ); // error handler app.use(function(err, req, res, next) 500); res.render('error'); ); module.exports = app; //Server auf port 1337 server.listen(1337); console.log('Der Server läuft nun unter 1337'); Routing password in routing folder

var to express = require('express'); var router = express.Router(); var jsondata = "DATA"; /* gain home page. */ router.get('/api/alleAssets', function(req, res, next) console.log('Ich bin in der Methode'); res.send(bla :'bla') ); module.exports = router; Sorry because that some regulates ins German. I think they won´t be important to understand such simple code.Thanks for your help.

EDIT:This is the console log and also the error message once going top top the 2nd page:(The human body is connected to one onload function)

> peasec
0.0.0 begin C:\Users\Tim\Documents\University\UIP\PearSecExpress\PearSec\peasec > node ./bin/www Der Server läuft nun unter 1337 Error: No default engine was specified and also no extension was provided. at brand-new View (C:\Users\Tim\Documents\University\UIP\PearSecExpress\PearSec\peasec\node_modules\express\lib\view.js:61:11) at Function.render (C:\Users\Tim\Documents\University\UIP\PearSecExpress\PearSec\peasec\node_modules\express\lib\application.js:570:12) in ~ ServerResponse.render (C:\Users\Tim\Documents\University\UIP\PearSecExpress\PearSec\peasec\node_modules\express\lib\response.js:971:7) in ~ C:\Users\Tim\Documents\University\UIP\PearSecExpress\PearSec\peasec\app.js:41:7 at Layer.handle_error (C:\Users\Tim\Documents\University\UIP\PearSecExpress\PearSec\peasec\node_modules\express\lib\router\layer.js:71:5) in ~ trim_prefix (C:\Users\Tim\Documents\University\UIP\PearSecExpress\PearSec\peasec\node_modules\express\lib\router\index.js:315:13) at C:\Users\Tim\Documents\University\UIP\PearSecExpress\PearSec\peasec\node_modules\express\lib\router\index.js:284:7 at Function.process_params (C:\Users\Tim\Documents\University\UIP\PearSecExpress\PearSec\peasec\node_modules\express\lib\router\index.js:335:12) at following (C:\Users\Tim\Documents\University\UIP\PearSecExpress\PearSec\peasec\node_modules\express\lib\router\index.js:275:10) at C:\Users\Tim\Documents\University\UIP\PearSecExpress\PearSec\peasec\app.js:30:3
You need to collection a templating engine to render pages. Instances for templating engines room Jade, EJS etc. The listed below line of password will collection your templating Engine to EJS, and also use it come render HTML content.

app.set('view engine', 'ejs'); Using EJS as templating engine needs your public papers to be .ejs extension. Following attach will aid you acquire a straightforward understanding of just how EJS works.https://scotch.io/tutorials/use-ejs-to-template-your-node-application

Give it a shot and also let me understand if it functions or not.

See more: Just Can T Let Her Go One Direction, Just Can'T Let Her Go


Forgot to mention, EJS is only compelled when you use dynamic content in her HTML page. If friend are having actually a revolution page, you can simply send the path of that revolution page.