Build a custom server
See original GitHub issueFeature
Custom server
Why is this feature being added?
The custom server will be needed for juicy SEO benefits.
As it stands, we cant just throw files into static and have it be immediately routable on the server.
With a custom server, we can add routes that point to static files for crawlers (example: robots.txt)
What should your feature do?
Something similar to this in <rootDir>/server.js
Warning, do not copy-paste:
const robotsOptions = {
root: __dirname + '/static/',
headers: {
'Content-Type': 'text/plain;charset=UTF-8',
}
};
server.get('/robots.txt', (req, res) => (
res.status(200).sendFile('robots.txt', robotsOptions)
));
const sitemapOptions = {
root: __dirname + '/static/',
headers: {
'Content-Type': 'text/xml;charset=UTF-8',
}
};
server.get('/sitemap.xml', (req, res) => (
res.status(200).sendFile('sitemap.xml', sitemapOptions)
));
const faviconOptions = {
root: __dirname + '/static/'
};
server.get('/favicon.ico', (req, res) => (
res.status(200).sendFile('favicon.ico', faviconOptions)
));
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Build & Configure Your Own Server Online - ETB Tech
Are you looking to build your own server? ETB Tech has a wide range of configurable servers in stock. You can configure and...
Read more >How to build a rack-mounted server from scratch
How to build a rack-mounted server from scratch · 1) Buy a server from the big guys · 2) Buy a server from...
Read more >How To Build a Server and How Much Will it Cost? - Techjury
To create your own server, you need: CPU; Motherboard; RAM; Hard Drive; Cooling; Chassis; Power supply; Graphics card (Optional); DVD Drive (Optional). Aside ......
Read more >Configure a Custom Server | Puget Systems
Customize a Puget Systems rackmount server for your specific needs. Our custom configuration tool lets you pick the parts and specs you want....
Read more >Build Your Own Server - Custom Server - Aventis Systems
Build your own server to fit your needs today. This allows you to pick and choose what you want and need to best...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks @kylemh I have been busy working at Dell. I made this issue before I started, and I’m going to open it up for other contributors. I apologise for the late response @dmarchante.
@ssiddhantsharma he was making an issue for himself to resolve. Consider this work assigned 👍