]> git.cworth.org Git - empires-server/blob - server.js
Extend our simple web API with a new /register endpoint
[empires-server] / server.js
1 const express = require("express")
2 const body_parser = require("body-parser");
3
4 const app = express();
5
6 app.use(body_parser.urlencoded({ extended: false }));
7 app.use(body_parser.json());
8
9 app.get('/', function (req, res) {
10   res.send('Hello World!');
11 });
12
13 app.post('/register', function (req, res) {
14   console.log(req.body);
15 });
16
17 app.listen(3000, function () {
18   console.log('Example app listening on port 3000!');
19 });