Question

How do I display HTML on Next.JS? Like i have a website localhost3000 and i want...

How do I display HTML on Next.JS? Like i have a website localhost3000 and i want my html to display there

0 0
Add a comment Improve this question Transcribed image text
Answer #1

You need to format the output before actually returning to browser. So as for nextjs, first switch to the custom server nexjs custom server and routing and walkthrough procedure below :

In your main app.js or what is in it's place:

Express 4.x

if (app.get('env') === 'development') {

app.locals.pretty = true;

}

Express 3.x

app.configure('development', function(){

app.use(express.errorHandler());

app.locals.pretty = true;

});

Express 2.x

app.configure('development', function(){

app.use(express.errorHandler());

app.set('view options', { pretty: true });

});

I put the pretty print in development because you'll want more efficiency with the 'ugly' in production. Make sure to set environment variable NODE_ENV=production when you're deploying in production. This can be done with an sh script you use in the 'script' field of package.json and executed to start.

Express 3 changed this because:

The "view options" setting is no longer necessary, app.locals are the local variables merged with res.render()'s, so [app.locals.pretty = true is the same as passing res.render(view, { pretty: true }).

Add a comment
Know the answer?
Add Answer to:
How do I display HTML on Next.JS? Like i have a website localhost3000 and i want...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Can someone plz help me??? I would like a website that has to do with guitars...

    Can someone plz help me??? I would like a website that has to do with guitars or something to do with music, someone asked me what kind of website I would like to have and that would be awesome. The attributes to be included, are below. I need a small website that to where I need to interlink a CSS file into the HTML file. I don't know to save the files to have to be able to run with...

  • I have to create a website (using html) with three different tabs that consists of: -...

    I have to create a website (using html) with three different tabs that consists of: - Home page - Contact Us - Calender I was wondering how I go about doing so. I already have made the home page, contact us, and calender but I'm not sure how to put it onto one website and how to make tabs for contact us, calender, and the home page. Also, my professor asked us to do this as well: You will provide...

  • make a interactive website from scratch. using code. html, css. I want it to be about...

    make a interactive website from scratch. using code. html, css. I want it to be about people on   Dialysis, and how we can help to make them more comfortable. Thank you for your help.

  • I have a text file with some quotes and I want to use php or laravel...

    I have a text file with some quotes and I want to use php or laravel to pull one quote at a time and display it to my website upon every page refresh. How do I use PHP or Laravel to pull one quote at a time from the text file (saved in my project as quotes.txt) and display it on my webpage? I am also open to using ajax and/or javascript.

  • In my HTML and CSS project I want to apply a picture to the bottom right...

    In my HTML and CSS project I want to apply a picture to the bottom right corner... can I get help on how to do this (ie code and a good example)? Here is a sample of my css code: CSS: html {     background: url(jb_back2.png) center center / cover no-repeat fixed; } body {     max-width: 960px;     margin-left: auto;     margin-right: auto;     /*display: -webkit-box;     display: -moz-box;     display: -ms-flexbox;     display: -webkit-flex;*/     display: flex;    ...

  • I have a web development project. First, it requires to have a website with a simple...

    I have a web development project. First, it requires to have a website with a simple design like the picture. Second, after fill in the information in the text box, click submit, the information will be save in the database using MySQL. Must have a captcha (like Google Captcha) to reduce spam. Also, must have a database password encryption. You can code this using php, html for coding, and css for designing. Third, code a php file to show all...

  • i want to create a website for my project . all 48% 2:02 a Expert Q&A...

    i want to create a website for my project . all 48% 2:02 a Expert Q&A course, you should make a personal website for yourself The completod website should have a minimem of 4 pages. You con decide abour the content and organiration of the pages as you like .The overall design of your webeite will be evalusted (inclading olor schems, creativity, layout, originality, etc) The visual appearance of your website is important All papes should pass validation The website...

  • I created an Html with tabs, then how do I import the constant character content of...

    I created an Html with tabs, then how do I import the constant character content of a JS into one of these tabs without editing that JS file? here is my page: <!DOCTYPE html> <html> <body>     <div id="main">         <span class="tab">             <button class="current">News</button>             <button>Create</button>             <button onclick="about()">About</button>             <button>Login</button>         </span>         <div class="con" style="display: block"> For news content</div>         <div class="con">For create content</div>         <div class="con" id="about">For about content</div>     </div> </body> <script type="text/javascript" src='strings.js'></script> <script>     var box = document.getElementById('main');     var btns = document.getElementsByTagName('button');     var divs =...

  • I would like to know how to utilize mongodb database. I have the software I even...

    I would like to know how to utilize mongodb database. I have the software I even created a database but I have no idea how to use it in my application to build a banking online website. I will be using the database just to store clients information and bank account numbers. see my last question if possible

  • To create a website I create Psd Files for the design (Phase 1) I Convert these...

    To create a website I create Psd Files for the design (Phase 1) I Convert these Psd's to html/css static webpages (Phase 2) I add some javascript to these webpages (Phase 3) I start the IDE "visual web developper" to start developping (Phase 4) I have studied computer programming for the past five years and now I noticed that the corresponding phase (phase 4) of creating a website takes the least amount time and effort in entire process. All the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT