Skip to content

Commit 126e29f

Browse files
committed
Initial commit
Created from https://vercel.com/new
0 parents  commit 126e29f

File tree

4 files changed

+86
-0
lines changed

4 files changed

+86
-0
lines changed

.gitignore

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# Dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# Testing
9+
/coverage
10+
11+
# Production
12+
build
13+
dist
14+
15+
# Misc
16+
.DS_Store
17+
*.pem
18+
19+
# Debug
20+
npm-debug.log*
21+
yarn-debug.log*
22+
yarn-error.log*
23+
24+
# Local ENV files
25+
.env.local
26+
.env.development.local
27+
.env.test.local
28+
.env.production.local
29+
30+
# Vercel
31+
.vercel
32+
33+
# Turborepo
34+
.turbo
35+
36+
# typescript
37+
*.tsbuildinfo

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Node.js Hello World
2+
3+
Simple Node.js + Vercel example that returns a "Hello World" response.
4+
5+
## How to Use
6+
7+
You can choose from one of the following two methods to use this repository:
8+
9+
### One-Click Deploy
10+
11+
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=vercel-examples):
12+
13+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/examples/tree/main/solutions/node-hello-world&project-name=node-hello-world&repository-name=node-hello-world)
14+
15+
### Clone and Deploy
16+
17+
```bash
18+
git clone https://github.com/vercel/examples/tree/main/solutions/node-hello-world
19+
```
20+
21+
Install the Vercel CLI:
22+
23+
```bash
24+
npm i -g vercel
25+
```
26+
27+
Then run the app at the root of the repository:
28+
29+
```bash
30+
vercel dev
31+
```

api/hello.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { VercelRequest, VercelResponse } from '@vercel/node'
2+
3+
export default function handler(req: VercelRequest, res: VercelResponse) {
4+
const { name = 'World' } = req.query
5+
return res.json({
6+
message: `Hello ${name}!`,
7+
})
8+
}

package.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"repository": "https://github.com/vercel/examples.git",
3+
"license": "MIT",
4+
"private": true,
5+
"devDependencies": {
6+
"@types/node": "^17.0.42",
7+
"@vercel/node": "^2.9.6",
8+
"typescript": "^4.7.3"
9+
}
10+
}

0 commit comments

Comments
 (0)