mirror of
https://github.com/SrIzan10/starters.git
synced 2026-05-01 11:05:16 +00:00
Add http-nodejs starter (#73)
* Add http-nodejs starter * Fix name in package.json
This commit is contained in:
1
examples/http-nodejs/.gitignore
vendored
Normal file
1
examples/http-nodejs/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules/
|
||||
15
examples/http-nodejs/README.md
Normal file
15
examples/http-nodejs/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# HTTP Module Example
|
||||
|
||||
This example starts an [HTTP Module](https://nodejs.org/api/http.html) server.
|
||||
|
||||
[](https://railway.app/new?template=https%3A%2F%2Fgithub.com%2Frailwayapp%2Fexamples%2Ftree%2Fmaster%2Fexamples%2Fhttp-nodejs)
|
||||
|
||||
## 💁♀️ How to use
|
||||
|
||||
- Install dependencies `yarn`
|
||||
- Connect to your Railway project `railway init`
|
||||
- Start the development server `railway run yarn dev`
|
||||
|
||||
## 📝 Notes
|
||||
|
||||
The server started simply returns a `Hello World` payload. The server code is located in `server.mjs`.
|
||||
10
examples/http-nodejs/package.json
Normal file
10
examples/http-nodejs/package.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "http-nodejs",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"author": "Aiden Bai",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"start": "node server.mjs"
|
||||
}
|
||||
}
|
||||
6
examples/http-nodejs/server.mjs
Normal file
6
examples/http-nodejs/server.mjs
Normal file
@@ -0,0 +1,6 @@
|
||||
import { createServer } from 'http';
|
||||
|
||||
createServer((req, res) => {
|
||||
res.write('Hello World!');
|
||||
res.end();
|
||||
}).listen(process.env.PORT);
|
||||
4
examples/http-nodejs/yarn.lock
Normal file
4
examples/http-nodejs/yarn.lock
Normal file
@@ -0,0 +1,4 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user