//安装依赖
npm install
//开启服务
npm start
//src/index.js
import express from "express";
import path from "path";
import cors from "cors";
import bodyParser from "body-parser";
import api from "../routes/api";
const port = process.env.port || 3000;
const app = express();
app.use(cors());
app.use(bodyParser.json());
app.get("/", (req, res) => {
res.sendFile(path.join(__dirname, "index.html"));
});
app.use("/api", api);
app.listen(port, () => {
console.log(`Server is running on port ${port}...`);
});
-
Notifications
You must be signed in to change notification settings - Fork 0
oOBobbyOo/restful-api
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description or website provided.
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published