Created
December 24, 2020 00:29
-
-
Save omar2205/f21f3ce250906655752446e6f266d4aa to your computer and use it in GitHub Desktop.
Vercel express server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "something", | |
"version": "2.2.0", | |
"description": "", | |
"main": "index.js", | |
"dependencies": { | |
"ejs": "^3.1.5", | |
"express": "^4.17.1", | |
"helmet": "^4.2.0" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path') | |
const express = require('express') | |
const app = express() | |
const helmet = require('helmet') | |
const viewsPath = path.join(__dirname, './views') | |
app.set('view engine', 'ejs') | |
app.set('views', viewsPath) | |
app.disable('x-powered-by') | |
app.use(helmet()) | |
app.get('/', async (req, res) => { | |
res.render('index.ejs', { data: data.default }) | |
}) | |
app.listen(3000) | |
module.exports = app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 2, | |
"builds": [ | |
{ | |
"src": "index.js", | |
"use": "@now/node-server" | |
}, | |
{ | |
"src": "/public/*", | |
"use": "@vercel/static" | |
} | |
], | |
"routes": [ | |
{ "handle": "filesystem" }, | |
{ "src": "/.*", "dest": "index.js"} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment